From afe40879127ff99d1de6ed8683f6a0e76c0827b9 Mon Sep 17 00:00:00 2001 From: Daniel Brooks Date: Sun, 30 May 2021 23:16:58 -0700 Subject: Don’t erase text behind a sixel image; the image might be transparent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- alacritty_terminal/src/term/mod.rs | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'alacritty_terminal/src') 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 Handler for Term { // 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 Handler for Term { // 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(); } -- cgit