aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/term/mod.rs
diff options
context:
space:
mode:
authorDaniel Brooks <db48x@db48x.net>2021-05-30 23:16:58 -0700
committerbetaboon <betaboon@0x80.ninja>2021-08-17 15:49:26 +0200
commitafe40879127ff99d1de6ed8683f6a0e76c0827b9 (patch)
treef70182fffca747ec117bdc42103413cbd2e7e874 /alacritty_terminal/src/term/mod.rs
parentf9d610f4c2e7e851bf7ebad808a44d2ae0b4996e (diff)
downloadr-alacritty-afe40879127ff99d1de6ed8683f6a0e76c0827b9.tar.gz
r-alacritty-afe40879127ff99d1de6ed8683f6a0e76c0827b9.tar.bz2
r-alacritty-afe40879127ff99d1de6ed8683f6a0e76c0827b9.zip
Don’t erase text behind a sixel image; the image might be transparent
We still add a reference to the graphic in the first cell of every line under the image, but we don’t erase any of the text in any of the cells.
Diffstat (limited to 'alacritty_terminal/src/term/mod.rs')
-rw-r--r--alacritty_terminal/src/term/mod.rs13
1 files changed, 5 insertions, 8 deletions
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 80e16e20..b4ce9481 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -1842,13 +1842,14 @@ impl<T: EventListener> Handler for Term<T> {
// Fill the cells under the graphic.
//
- // The cell in the first column contains a reference to the graphic,
- // with the offset from the start. Rest of the cells are empty.
+ // The cell in the first column contains a reference to the
+ // graphic, with the offset from the start. The rest of the
+ // cells are not overwritten, allowing any text behind
+ // transparent portions of the image to be visible.
let left = if scrolling { self.grid.cursor.point.column.0 } else { 0 };
let graphic_columns = (graphic.width + self.cell_width - 1) / self.cell_width;
- let right = min(self.columns(), left + graphic_columns);
let texture = Arc::new(TextureRef {
id: graphic_id,
@@ -1869,14 +1870,10 @@ impl<T: EventListener> Handler for Term<T> {
// Store a reference to the graphic in the first column.
let graphic_cell = GraphicCell { texture: texture.clone(), offset_x: 0, offset_y };
- let mut cell = Cell::default();
+ let mut cell = self.grid[line][Column(left)].clone();
cell.set_graphic(graphic_cell);
self.grid[line][Column(left)] = cell;
- for col in left + 1..right {
- self.grid[line][Column(col)] = Cell::default();
- }
-
if scrolling {
self.linefeed();
}