mirror of
https://github.com/alacritty/alacritty.git
synced 2024-11-18 13:55:23 -05:00
Reset grid when running reset
In the current scrollback PR the `reset` command does not affect the scrollback history. To make sure the terminal is properly reset, it should clear the scrollback history. To make resetting efficient, instead of resetting the history, the scrollback history is hidden by setting `grid.scroll_limit` to `0`. This will not clear the history but instead just make it inaccessible, which should have the same effect. The visible area is reset by the shell itself, so in combination this clears the complete terminal grid from a user perspective. This fixes #1242.
This commit is contained in:
parent
88305677f5
commit
cf23f56999
2 changed files with 6 additions and 3 deletions
|
@ -403,6 +403,10 @@ impl<T> Grid<T> {
|
|||
self.cols
|
||||
}
|
||||
|
||||
pub fn reset(&mut self) {
|
||||
self.scroll_limit = 0;
|
||||
}
|
||||
|
||||
pub fn iter_from(&self, point: Point<usize>) -> GridIterator<T> {
|
||||
GridIterator {
|
||||
grid: self,
|
||||
|
|
|
@ -837,13 +837,11 @@ impl Term {
|
|||
}
|
||||
|
||||
pub fn new(config: &Config, size: SizeInfo) -> Term {
|
||||
let template = Cell::default();
|
||||
|
||||
let num_cols = size.cols();
|
||||
let num_lines = size.lines();
|
||||
|
||||
let history_size = config.scrolling().history as usize;
|
||||
let grid = Grid::new(num_lines, num_cols, history_size, template);
|
||||
let grid = Grid::new(num_lines, num_cols, history_size, Cell::default());
|
||||
|
||||
let tabspaces = config.tabspaces();
|
||||
let tabs = IndexRange::from(Column(0)..grid.num_cols())
|
||||
|
@ -1818,6 +1816,7 @@ impl ansi::Handler for Term {
|
|||
self.colors = self.original_colors;
|
||||
self.color_modified = [false; color::COUNT];
|
||||
self.cursor_style = None;
|
||||
self.grid.reset();
|
||||
}
|
||||
|
||||
#[inline]
|
||||
|
|
Loading…
Reference in a new issue