aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Brooks <db48x@db48x.net>2021-05-30 23:16:58 -0700
committerDaniel Brooks <db48x@db48x.net>2021-05-30 23:16:58 -0700
commit9723e3f9ebc7699f3e9ec912ad62d586ffe1dafe (patch)
tree3f6f023e6a89491a6f190e3e676ea286a45fb2b5
parente5e9c8293535ea6eaaa3d017cbfb322c7ac95c14 (diff)
downloadr-alacritty-9723e3f9ebc7699f3e9ec912ad62d586ffe1dafe.tar.gz
r-alacritty-9723e3f9ebc7699f3e9ec912ad62d586ffe1dafe.tar.bz2
r-alacritty-9723e3f9ebc7699f3e9ec912ad62d586ffe1dafe.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.
-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 5ca15b21..f08eeb19 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -1803,13 +1803,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,
@@ -1830,14 +1831,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();
}