From 62d5b134b3c32b6b691bb6aa6304e3d5d5c28c6d Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Sat, 28 Dec 2024 08:53:18 +0300 Subject: Add CSI Ps I support The implementation is the same as CSI Ps Z, but forward. --- alacritty_terminal/src/term/mod.rs | 30 ++++++++++++++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) (limited to 'alacritty_terminal/src/term/mod.rs') diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index c2d77ec7..84945f52 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -1566,11 +1566,15 @@ impl Handler for Term { #[inline] fn move_backward_tabs(&mut self, count: u16) { trace!("Moving backward {} tabs", count); - self.damage_cursor(); let old_col = self.grid.cursor.point.column.0; for _ in 0..count { let mut col = self.grid.cursor.point.column; + + if col == 0 { + break; + } + for i in (0..(col.0)).rev() { if self.tabs[index::Column(i)] { col = index::Column(i); @@ -1586,7 +1590,29 @@ impl Handler for Term { #[inline] fn move_forward_tabs(&mut self, count: u16) { - trace!("[unimplemented] Moving forward {} tabs", count); + trace!("Moving forward {} tabs", count); + + let num_cols = self.columns(); + let old_col = self.grid.cursor.point.column.0; + for _ in 0..count { + let mut col = self.grid.cursor.point.column; + + if col == num_cols - 1 { + break; + } + + for i in col.0 + 1..num_cols { + col = index::Column(i); + if self.tabs[col] { + break; + } + } + + self.grid.cursor.point.column = col; + } + + let line = self.grid.cursor.point.line.0 as usize; + self.damage.damage_line(line, old_col, self.grid.cursor.point.column.0); } #[inline] -- cgit