diff options
author | Richard Steinmetz <richard@steinmetz.cloud> | 2021-03-31 21:11:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-03-31 19:11:16 +0000 |
commit | 58cae8f2edf44e6bf0721543c61edb57bdf7d776 (patch) | |
tree | 4f20cae7d3069ccc8e03ffee514a5d0605f85b9e /alacritty_terminal/src/grid/resize.rs | |
parent | 3bd5ac221ab3b122962063edd1f4c10f9f2d117f (diff) | |
download | alacritty-58cae8f2edf44e6bf0721543c61edb57bdf7d776.tar.gz alacritty-58cae8f2edf44e6bf0721543c61edb57bdf7d776.zip |
Keep viewport in place during resize
Fixes #4879.
Co-authored-by: Christian Duerr <contact@christianduerr.com>
Diffstat (limited to 'alacritty_terminal/src/grid/resize.rs')
-rw-r--r-- | alacritty_terminal/src/grid/resize.rs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/alacritty_terminal/src/grid/resize.rs b/alacritty_terminal/src/grid/resize.rs index eb8bef0c..10bc51f9 100644 --- a/alacritty_terminal/src/grid/resize.rs +++ b/alacritty_terminal/src/grid/resize.rs @@ -187,7 +187,7 @@ impl<T: GridCell + Default + PartialEq + Clone> Grid<T> { cursor_line_delta += line_delta.0 as usize; } else if row.is_clear() { - if i + reversed.len() >= self.lines { + if i <= self.display_offset { // Since we removed a line, rotate down the viewport. self.display_offset = self.display_offset.saturating_sub(1); } @@ -354,6 +354,11 @@ impl<T: GridCell + Default + PartialEq + Clone> Grid<T> { wrapped.resize_with(columns, T::default); } row = Row::from_vec(wrapped, occ); + + if i <= self.display_offset { + // Since we added a new line, rotate up the viewport. + self.display_offset += 1; + } } } } |