summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJoe Wilm <joe@jwilm.com>2017-04-18 10:42:29 -0700
committerJoe Wilm <joe@jwilm.com>2017-04-18 19:53:31 -0700
commita3d00f01b136ce95613bb20db9e05bfe9342185b (patch)
treee13174b9c9d7c531a4be66b849b0d84578d1e6dc /src
parenta27f166ef92b7782ee5833bf51d8559d1bb47934 (diff)
Fixes for vttest cursor movement screen 1
Diffstat (limited to 'src')
-rw-r--r--src/ansi.rs16
-rw-r--r--src/term/mod.rs16
2 files changed, 29 insertions, 3 deletions
diff --git a/src/ansi.rs b/src/ansi.rs
index df445031..2b71e537 100644
--- a/src/ansi.rs
+++ b/src/ansi.rs
@@ -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)
diff --git a/src/term/mod.rs b/src/term/mod.rs
index 1e9201aa..990a574b 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -1101,6 +1101,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);
self.cursor.point.line = min(line, self.grid.num_lines() - 1);
@@ -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);
}
},