From c31166c08781466b4dc42367ded8be67822f0d98 Mon Sep 17 00:00:00 2001 From: zach Date: Thu, 4 Jun 2026 14:53:05 +0200 Subject: [PATCH] repaint when cursor moves --- src/terminal.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/terminal.rs b/src/terminal.rs index dc5aa9d..3220c4c 100644 --- a/src/terminal.rs +++ b/src/terminal.rs @@ -1443,16 +1443,19 @@ impl Handler for Terminal { if self.cursor_col > 0 { self.cursor_col -= 1; } + self.mark_line_dirty(self.cursor_row); } 0x09 => { let next_tab = (self.cursor_col / 8 + 1) * 8; self.cursor_col = next_tab.min(self.cols - 1); + self.mark_line_dirty(self.cursor_row); } 0x0A | 0x0B | 0x0C => { self.advance_row(); } 0x0D => { self.cursor_col = 0; + self.mark_line_dirty(self.cursor_row); } _ => {} } @@ -1712,6 +1715,7 @@ impl Handler for Terminal { if self.origin_mode { self.scroll_top } else { 0 }; self.cursor_row = self.cursor_row.saturating_sub(n).max(min_row); + self.mark_line_dirty(self.cursor_row); } 'B' => { let n = params.get(0, 1).max(1) as usize; @@ -1721,6 +1725,7 @@ impl Handler for Terminal { self.rows - 1 }; self.cursor_row = (self.cursor_row + n).min(max_row); + self.mark_line_dirty(self.cursor_row); } // Cursor Forward 'C' => { @@ -1733,11 +1738,13 @@ impl Handler for Terminal { old_col, self.cursor_col ); + self.mark_line_dirty(self.cursor_row); } // Cursor Back 'D' => { let n = params.get(0, 1).max(1) as usize; self.cursor_col = self.cursor_col.saturating_sub(n); + self.mark_line_dirty(self.cursor_row); } 'E' => { let n = params.get(0, 1).max(1) as usize; @@ -1748,6 +1755,7 @@ impl Handler for Terminal { }; self.cursor_col = 0; self.cursor_row = (self.cursor_row + n).min(max_row); + self.mark_line_dirty(self.cursor_row); } 'F' => { let n = params.get(0, 1).max(1) as usize; @@ -1756,6 +1764,7 @@ impl Handler for Terminal { self.cursor_col = 0; self.cursor_row = self.cursor_row.saturating_sub(n).max(min_row); + self.mark_line_dirty(self.cursor_row); } // Cursor Horizontal Absolute (CHA) 'G' => { @@ -1767,6 +1776,7 @@ impl Handler for Terminal { self.cursor_col, old_col ); + self.mark_line_dirty(self.cursor_row); } // Cursor Position 'H' | 'f' => { @@ -1780,6 +1790,7 @@ impl Handler for Terminal { self.cursor_row = (row - 1).min(self.rows - 1); } self.cursor_col = (col - 1).min(self.cols - 1); + self.mark_line_dirty(self.cursor_row); } // Erase in Display 'J' => { @@ -2177,6 +2188,7 @@ impl Handler for Terminal { } else { self.cursor_row += 1; } + self.mark_line_dirty(self.cursor_row); } fn newline(&mut self) { @@ -2186,6 +2198,7 @@ impl Handler for Terminal { } else { self.cursor_row += 1; } + self.mark_line_dirty(self.cursor_row); } fn reverse_index(&mut self) { @@ -2194,6 +2207,7 @@ impl Handler for Terminal { } else { self.cursor_row -= 1; } + self.mark_line_dirty(self.cursor_row); } fn set_tab_stop(&mut self) {