aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2024-12-28 08:53:18 +0300
committerGitHub <noreply@github.com>2024-12-28 08:53:18 +0300
commit62d5b134b3c32b6b691bb6aa6304e3d5d5c28c6d (patch)
tree410e2e1999f7f81e26e570d5a31904619af9945d
parentd45eca8268eea0a1bba58dae5cc4b70c2482c7c4 (diff)
downloadalacritty-62d5b134b3c32b6b691bb6aa6304e3d5d5c28c6d.tar.gz
alacritty-62d5b134b3c32b6b691bb6aa6304e3d5d5c28c6d.zip
Add CSI Ps I support
The implementation is the same as CSI Ps Z, but forward.
-rw-r--r--CHANGELOG.md1
-rw-r--r--alacritty_terminal/CHANGELOG.md4
-rw-r--r--alacritty_terminal/src/term/mod.rs30
3 files changed, 33 insertions, 2 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 94672511..9e0aefe1 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -13,6 +13,7 @@ Notable changes to the `alacritty_terminal` crate are documented in its
### Added
- Config option `window.level = "AlwaysOnTop"` to force Alacritty to always be the toplevel window
+- Escape sequence to move cursor forward tabs ( CSI Ps I )
### Changed
diff --git a/alacritty_terminal/CHANGELOG.md b/alacritty_terminal/CHANGELOG.md
index 28ed7540..a6ee32b2 100644
--- a/alacritty_terminal/CHANGELOG.md
+++ b/alacritty_terminal/CHANGELOG.md
@@ -10,6 +10,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 0.24.2-dev
+### Added
+
+- Escape sequence to move cursor forward tabs ( CSI Ps I )
+
## 0.24.1
### Changed
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<T: EventListener> Handler for Term<T> {
#[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<T: EventListener> Handler for Term<T> {
#[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]