repaint when cursor moves

This commit is contained in:
2026-06-04 14:53:05 +02:00
parent f07b1724d9
commit c31166c087
+14
View File
@@ -1443,16 +1443,19 @@ impl Handler for Terminal {
if self.cursor_col > 0 { if self.cursor_col > 0 {
self.cursor_col -= 1; self.cursor_col -= 1;
} }
self.mark_line_dirty(self.cursor_row);
} }
0x09 => { 0x09 => {
let next_tab = (self.cursor_col / 8 + 1) * 8; let next_tab = (self.cursor_col / 8 + 1) * 8;
self.cursor_col = next_tab.min(self.cols - 1); self.cursor_col = next_tab.min(self.cols - 1);
self.mark_line_dirty(self.cursor_row);
} }
0x0A | 0x0B | 0x0C => { 0x0A | 0x0B | 0x0C => {
self.advance_row(); self.advance_row();
} }
0x0D => { 0x0D => {
self.cursor_col = 0; 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 }; if self.origin_mode { self.scroll_top } else { 0 };
self.cursor_row = self.cursor_row =
self.cursor_row.saturating_sub(n).max(min_row); self.cursor_row.saturating_sub(n).max(min_row);
self.mark_line_dirty(self.cursor_row);
} }
'B' => { 'B' => {
let n = params.get(0, 1).max(1) as usize; let n = params.get(0, 1).max(1) as usize;
@@ -1721,6 +1725,7 @@ impl Handler for Terminal {
self.rows - 1 self.rows - 1
}; };
self.cursor_row = (self.cursor_row + n).min(max_row); self.cursor_row = (self.cursor_row + n).min(max_row);
self.mark_line_dirty(self.cursor_row);
} }
// Cursor Forward // Cursor Forward
'C' => { 'C' => {
@@ -1733,11 +1738,13 @@ impl Handler for Terminal {
old_col, old_col,
self.cursor_col self.cursor_col
); );
self.mark_line_dirty(self.cursor_row);
} }
// Cursor Back // Cursor Back
'D' => { 'D' => {
let n = params.get(0, 1).max(1) as usize; let n = params.get(0, 1).max(1) as usize;
self.cursor_col = self.cursor_col.saturating_sub(n); self.cursor_col = self.cursor_col.saturating_sub(n);
self.mark_line_dirty(self.cursor_row);
} }
'E' => { 'E' => {
let n = params.get(0, 1).max(1) as usize; let n = params.get(0, 1).max(1) as usize;
@@ -1748,6 +1755,7 @@ impl Handler for Terminal {
}; };
self.cursor_col = 0; self.cursor_col = 0;
self.cursor_row = (self.cursor_row + n).min(max_row); self.cursor_row = (self.cursor_row + n).min(max_row);
self.mark_line_dirty(self.cursor_row);
} }
'F' => { 'F' => {
let n = params.get(0, 1).max(1) as usize; let n = params.get(0, 1).max(1) as usize;
@@ -1756,6 +1764,7 @@ impl Handler for Terminal {
self.cursor_col = 0; self.cursor_col = 0;
self.cursor_row = self.cursor_row =
self.cursor_row.saturating_sub(n).max(min_row); self.cursor_row.saturating_sub(n).max(min_row);
self.mark_line_dirty(self.cursor_row);
} }
// Cursor Horizontal Absolute (CHA) // Cursor Horizontal Absolute (CHA)
'G' => { 'G' => {
@@ -1767,6 +1776,7 @@ impl Handler for Terminal {
self.cursor_col, self.cursor_col,
old_col old_col
); );
self.mark_line_dirty(self.cursor_row);
} }
// Cursor Position // Cursor Position
'H' | 'f' => { 'H' | 'f' => {
@@ -1780,6 +1790,7 @@ impl Handler for Terminal {
self.cursor_row = (row - 1).min(self.rows - 1); self.cursor_row = (row - 1).min(self.rows - 1);
} }
self.cursor_col = (col - 1).min(self.cols - 1); self.cursor_col = (col - 1).min(self.cols - 1);
self.mark_line_dirty(self.cursor_row);
} }
// Erase in Display // Erase in Display
'J' => { 'J' => {
@@ -2177,6 +2188,7 @@ impl Handler for Terminal {
} else { } else {
self.cursor_row += 1; self.cursor_row += 1;
} }
self.mark_line_dirty(self.cursor_row);
} }
fn newline(&mut self) { fn newline(&mut self) {
@@ -2186,6 +2198,7 @@ impl Handler for Terminal {
} else { } else {
self.cursor_row += 1; self.cursor_row += 1;
} }
self.mark_line_dirty(self.cursor_row);
} }
fn reverse_index(&mut self) { fn reverse_index(&mut self) {
@@ -2194,6 +2207,7 @@ impl Handler for Terminal {
} else { } else {
self.cursor_row -= 1; self.cursor_row -= 1;
} }
self.mark_line_dirty(self.cursor_row);
} }
fn set_tab_stop(&mut self) { fn set_tab_stop(&mut self) {