aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Duerr <chrisduerr@users.noreply.github.com>2018-04-28 14:14:45 +0000
committerJoe Wilm <joe@jwilm.com>2018-06-02 09:56:50 -0700
commitd8bda60c3d8f906f1018012f4a55c7b894afb4b7 (patch)
tree0e26fe9e60c622d7c188a478ef5fe2f2ee8a988f
parentbfa926555145f9f578430b87bc1c1b72ef80589f (diff)
downloadalacritty-d8bda60c3d8f906f1018012f4a55c7b894afb4b7.tar.gz
alacritty-d8bda60c3d8f906f1018012f4a55c7b894afb4b7.zip
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.
-rw-r--r--src/grid/mod.rs4
-rw-r--r--src/term/mod.rs5
2 files changed, 6 insertions, 3 deletions
diff --git a/src/grid/mod.rs b/src/grid/mod.rs
index 313973a3..ac54f580 100644
--- a/src/grid/mod.rs
+++ b/src/grid/mod.rs
@@ -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,
diff --git a/src/term/mod.rs b/src/term/mod.rs
index f66753d9..fa204a55 100644
--- a/src/term/mod.rs
+++ b/src/term/mod.rs
@@ -838,13 +838,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())
@@ -1820,6 +1818,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]