From 4cc6421daa4ff5976ab43c67110a7a80a36541e5 Mon Sep 17 00:00:00 2001 From: Kirill Chibisov Date: Sun, 26 Jan 2020 16:49:58 +0300 Subject: Fix incorrect grid.len() and grid.history_size() --- alacritty_terminal/src/term/mod.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'alacritty_terminal/src/term/mod.rs') diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index e1f8fb30..eeacbf7f 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -937,7 +937,7 @@ impl Term { } self.default_cursor_style = config.cursor.style; self.dynamic_title = config.dynamic_title(); - self.grid.update_history(config.scrolling.history() as usize, &self.cursor.template); + self.grid.update_history(config.scrolling.history() as usize); } /// Convert the active selection to a String. @@ -1099,14 +1099,9 @@ impl Term { } // Move prompt down when growing if scrollback lines are available - if num_lines > old_lines { - if self.mode.contains(TermMode::ALT_SCREEN) { - let growage = min(num_lines - old_lines, Line(self.alt_grid.scroll_limit())); - self.cursor_save.point.line += growage; - } else { - let growage = min(num_lines - old_lines, Line(self.grid.scroll_limit())); - self.cursor.point.line += growage; - } + if num_lines > old_lines && !self.mode.contains(TermMode::ALT_SCREEN) { + let growage = min(num_lines - old_lines, Line(self.grid.history_size())); + self.cursor.point.line += growage; } debug!("New num_cols is {} and num_lines is {}", num_cols, num_lines); @@ -2298,6 +2293,11 @@ mod tests { // Make sure that scrolling does not change the grid let mut scrolled_grid = term.grid.clone(); scrolled_grid.scroll_display(Scroll::Top); + + // Truncate grids for comparison + scrolled_grid.truncate(); + term.grid.truncate(); + assert_eq!(term.grid, scrolled_grid); } -- cgit