Reset visible area when RIS is received

When running bash and executing `echo -ne '\033c'`, the terminal should
be cleared. However there was an issue with the visible area not being
cleared, so all the text previously printed would still remain visible.

To fix this, whenever a `reset` call is received now, the complete
visible area is reset to `Cell::default()` (the default Cell) and the
length of the available scrollback history is reset to `0`, which
results in the scrollback history being cleared from the perspective of
the user.

This fixes #1483.
This commit is contained in:
Christian Duerr 2018-08-03 22:12:23 +00:00 committed by GitHub
parent 23601fbefc
commit facab5beef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -413,7 +413,7 @@ impl<T> Grid<T> {
self.cols
}
pub fn reset(&mut self) {
pub fn clear_history(&mut self) {
self.scroll_limit = 0;
}

View File

@ -1825,7 +1825,8 @@ impl ansi::Handler for Term {
self.colors = self.original_colors;
self.color_modified = [false; color::COUNT];
self.cursor_style = None;
self.grid.reset();
self.grid.clear_history();
self.grid.region_mut(..).each(|c| c.reset(&Cell::default()));
}
#[inline]