summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/grid/resize.rs
diff options
context:
space:
mode:
Diffstat (limited to 'alacritty_terminal/src/grid/resize.rs')
-rw-r--r--alacritty_terminal/src/grid/resize.rs17
1 files changed, 15 insertions, 2 deletions
diff --git a/alacritty_terminal/src/grid/resize.rs b/alacritty_terminal/src/grid/resize.rs
index 796c5859..95a8c2fc 100644
--- a/alacritty_terminal/src/grid/resize.rs
+++ b/alacritty_terminal/src/grid/resize.rs
@@ -67,10 +67,12 @@ impl<T: GridCell + Default + PartialEq + Copy> Grid<T> {
self.scroll_up(&(Line(0)..self.lines), Line(required_scrolling), T::default());
// Clamp cursors to the new viewport size.
- self.saved_cursor.point.line = min(self.saved_cursor.point.line, target - 1);
self.cursor.point.line = min(self.cursor.point.line, target - 1);
}
+ // Clamp saved cursor, since only primary cursor is scrolled into viewport.
+ self.saved_cursor.point.line = min(self.saved_cursor.point.line, target - 1);
+
self.raw.rotate((self.lines - target).0 as isize);
self.raw.shrink_visible_lines(target);
self.lines = target;
@@ -135,7 +137,8 @@ impl<T: GridCell + Default + PartialEq + Copy> Grid<T> {
// Reflow cells to previous row.
last_row.append(&mut cells);
- if row.is_empty() {
+ let cursor_buffer_line = (self.lines - self.cursor.point.line - 1).0;
+ if row.is_clear() && (i != cursor_buffer_line || row.len() == 0) {
if i + reversed.len() < self.lines.0 {
// Add new line and move everything up if we can't pull from history.
self.saved_cursor.point.line.0 = self.saved_cursor.point.line.saturating_sub(1);
@@ -144,6 +147,16 @@ impl<T: GridCell + Default + PartialEq + Copy> Grid<T> {
} else {
// Since we removed a line, rotate down the viewport.
self.display_offset = self.display_offset.saturating_sub(1);
+
+ // Rotate cursors down if content below them was pulled from history.
+ if i < cursor_buffer_line {
+ self.cursor.point.line += 1;
+ }
+
+ let saved_buffer_line = (self.lines - self.saved_cursor.point.line - 1).0;
+ if i < saved_buffer_line {
+ self.saved_cursor.point.line += 1;
+ }
}
// Don't push line into the new buffer.