Implement 'backwards tab'

This escape sequence isn't officially documented anywhere, but is
supported by xterm and gnome-vte.
This commit is contained in:
Aaron Hill 2017-06-15 15:46:53 -04:00 committed by Joe Wilm
parent 3c8514ba10
commit 1bd5c45b14
1 changed files with 13 additions and 6 deletions

View File

@ -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]