Implement 'backwards tab'
This escape sequence isn't officially documented anywhere, but is supported by xterm and gnome-vte.
This commit is contained in:
parent
3c8514ba10
commit
1bd5c45b14
|
@ -696,12 +696,10 @@ impl Term {
|
||||||
|
|
||||||
let grid = Grid::new(num_lines, num_cols, &template);
|
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)
|
.map(|i| (*i as usize) % TAB_SPACES == 0)
|
||||||
.collect::<Vec<bool>>();
|
.collect::<Vec<bool>>();
|
||||||
|
|
||||||
tabs[0] = false;
|
|
||||||
|
|
||||||
let alt = grid.clone();
|
let alt = grid.clone();
|
||||||
let scroll_region = Line(0)..grid.num_lines();
|
let scroll_region = Line(0)..grid.num_lines();
|
||||||
|
|
||||||
|
@ -1039,8 +1037,6 @@ impl Term {
|
||||||
.map(|i| (*i as usize) % TAB_SPACES == 0)
|
.map(|i| (*i as usize) % TAB_SPACES == 0)
|
||||||
.collect::<Vec<bool>>();
|
.collect::<Vec<bool>>();
|
||||||
|
|
||||||
self.tabs[0] = false;
|
|
||||||
|
|
||||||
if num_lines > old_lines {
|
if num_lines > old_lines {
|
||||||
// Make sure bottom of terminal is clear
|
// Make sure bottom of terminal is clear
|
||||||
let template = self.empty_cell;
|
let template = self.empty_cell;
|
||||||
|
@ -1531,7 +1527,18 @@ impl ansi::Handler for Term {
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
fn move_backward_tabs(&mut self, count: i64) {
|
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]
|
#[inline]
|
||||||
|
|
Loading…
Reference in New Issue