From d8bda60c3d8f906f1018012f4a55c7b894afb4b7 Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Sat, 28 Apr 2018 14:14:45 +0000 Subject: 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. --- src/grid/mod.rs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/grid') 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 Grid { self.cols } + pub fn reset(&mut self) { + self.scroll_limit = 0; + } + pub fn iter_from(&self, point: Point) -> GridIterator { GridIterator { grid: self, -- cgit v1.2.3-54-g00ecf