Fixes for vttest cursor movement screen 1

This commit is contained in:
Joe Wilm 2017-04-18 10:42:29 -07:00
parent a27f166ef9
commit a3d00f01b1
2 changed files with 29 additions and 3 deletions

View File

@ -253,6 +253,9 @@ pub trait Handler {
/// Set an indexed color value
fn set_color(&mut self, usize, Rgb) {}
/// Run the dectest routine
fn dectest(&mut self) {}
}
/// Terminal modes
@ -902,14 +905,23 @@ impl<'a, H, W> vte::Perform for Performer<'a, H, W>
match byte {
b'B' => configure_charset!(StandardCharset::Ascii),
b'D' => self.handler.linefeed(),
b'E' => self.handler.newline(),
b'E' => {
self.handler.linefeed();
self.handler.carriage_return();
}
b'H' => self.handler.set_horizontal_tabstop(),
b'M' => self.handler.reverse_index(),
b'Z' => self.handler.identify_terminal(self.writer),
b'c' => self.handler.reset_state(),
b'0' => configure_charset!(StandardCharset::SpecialCharacterAndLineDrawing),
b'7' => self.handler.save_cursor_position(),
b'8' => self.handler.restore_cursor_position(),
b'8' => {
if !intermediates.is_empty() && intermediates[0] == b'#' {
self.handler.dectest();
} else {
self.handler.restore_cursor_position();
}
}
b'=' => self.handler.set_keypad_application_mode(),
b'>' => self.handler.unset_keypad_application_mode(),
b'\\' => (), // String terminator, do nothing (parser handles as string terminator)

View File

@ -1100,6 +1100,19 @@ impl ansi::Handler for Term {
}
#[inline]
fn dectest(&mut self) {
trace!("dectest");
let mut template = self.cursor.template;
template.c = 'E';
for row in &mut self.grid.lines_mut() {
for cell in row {
cell.reset(&template);
}
}
}
#[inline]
fn goto(&mut self, line: Line, col: Column) {
trace!("goto: line={}, col={}", line, col);
@ -1471,7 +1484,8 @@ impl ansi::Handler for Term {
}
}
// Clear up to the current column in the current line
for cell in &mut self.grid[self.cursor.point.line][..self.cursor.point.col] {
let end = min(self.cursor.point.col + 1, self.grid.num_cols());
for cell in &mut self.grid[self.cursor.point.line][..end] {
cell.reset(&template);
}
},