diff options
author | Kirill Chibisov <contact@kchibisov.com> | 2023-06-17 21:55:12 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-17 21:55:12 +0000 |
commit | ee938243586ae5482cf26ff238ddc99e66e1d1c4 (patch) | |
tree | fcd0c82bfa317bd26674f7fd508b7faf5e53ba6e /alacritty_terminal | |
parent | cb48ac92071c43a9163329b66b5f74a7fb3dca69 (diff) | |
download | alacritty-ee938243586ae5482cf26ff238ddc99e66e1d1c4.tar.gz alacritty-ee938243586ae5482cf26ff238ddc99e66e1d1c4.zip |
Fix the crash when shrinking scrolled terminal
display_offset was adjusted unconditionally, thus it could go
beyound the history limits, so clamp it to history like we do
in grow_colums.
Fixes #6862.
Diffstat (limited to 'alacritty_terminal')
-rw-r--r-- | alacritty_terminal/src/grid/resize.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/alacritty_terminal/src/grid/resize.rs b/alacritty_terminal/src/grid/resize.rs index 882c0c90..92ee55d7 100644 --- a/alacritty_terminal/src/grid/resize.rs +++ b/alacritty_terminal/src/grid/resize.rs @@ -368,6 +368,9 @@ impl<T: GridCell + Default + PartialEq + Clone> Grid<T> { reversed.truncate(self.max_scroll_limit + self.lines); self.raw.replace_inner(reversed); + // Clamp display offset in case some lines went off. + self.display_offset = min(self.display_offset, self.history_size()); + // Reflow the primary cursor, or clamp it if reflow is disabled. if !reflow { self.cursor.point.column = min(self.cursor.point.column, Column(columns - 1)); |