aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAaron Hill <aa1ronham@gmail.com>2017-06-15 15:46:53 -0400
committerJoe Wilm <jwilm@users.noreply.github.com>2017-06-18 17:03:13 -0700
commit1bd5c45b140446c3d2d4ba50a80457d01ebf82b7 (patch)
tree1f850ef62505313015b52bb848cdeec186d6425d
parent3c8514ba103d5d987d2269c421a3cc09e6784904 (diff)
downloadalacritty-1bd5c45b140446c3d2d4ba50a80457d01ebf82b7.tar.gz
alacritty-1bd5c45b140446c3d2d4ba50a80457d01ebf82b7.zip
Implement 'backwards tab'
This escape sequence isn't officially documented anywhere, but is supported by xterm and gnome-vte.
-rw-r--r--src/term/mod.rs19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 227e90d2..6cbd07d7 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -696,12 +696,10 @@ impl Term {
let grid = Grid::new(num_lines, num_cols, &template);
- let mut tabs = IndexRange::from(Column(0)..grid.num_cols())
+ let tabs = IndexRange::from(Column(0)..grid.num_cols())
.map(|i| (*i as usize) % TAB_SPACES == 0)
.collect::<Vec<bool>>();
- tabs[0] = false;
-
let alt = grid.clone();
let scroll_region = Line(0)..grid.num_lines();
@@ -1039,8 +1037,6 @@ impl Term {
.map(|i| (*i as usize) % TAB_SPACES == 0)
.collect::<Vec<bool>>();
- self.tabs[0] = false;
-
if num_lines > old_lines {
// Make sure bottom of terminal is clear
let template = self.empty_cell;
@@ -1531,7 +1527,18 @@ impl ansi::Handler for Term {
#[inline]
fn move_backward_tabs(&mut self, count: i64) {
- trace!("[unimplemented] move_backward_tabs: {}", count);
+ trace!("move_backward_tabs: {}", count);
+
+ for _ in 0..count {
+ let mut col = self.cursor.point.col;
+ for i in (0..(col.0)).rev() {
+ if self.tabs[i as usize] {
+ col = index::Column(i);
+ break;
+ }
+ }
+ self.cursor.point.col = col;
+ }
}
#[inline]