diff options
author | Christian Duerr <contact@christianduerr.com> | 2021-07-04 00:30:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-04 00:30:05 +0000 |
commit | 9e7655ec03aeacfd13efe3b0b304f86bf1da5e11 (patch) | |
tree | aa3685f77aa75781783a0330cc940d75921c6aa6 /alacritty_terminal/src/term/mod.rs | |
parent | c6ed855bfa036ffe5e3e3ea12819db6a1a25d4e1 (diff) | |
download | alacritty-9e7655ec03aeacfd13efe3b0b304f86bf1da5e11.tar.gz alacritty-9e7655ec03aeacfd13efe3b0b304f86bf1da5e11.zip |
Fix crash when resizing during vi mode
Our resize clamping logic for the vi mode cursor did not correctly clamp
to the viewport after the indexing change. Now it is enforced that the
vi mode cursor cannot leave the visible area after a font or viewport
size change.
Diffstat (limited to 'alacritty_terminal/src/term/mod.rs')
-rw-r--r-- | alacritty_terminal/src/term/mod.rs | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index 256f2f29..f25bf1ac 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -512,8 +512,10 @@ impl<T> Term<T> { // Clamp vi cursor to viewport. let vi_point = self.vi_mode_cursor.point; - self.vi_mode_cursor.point.column = min(vi_point.column, Column(num_cols - 1)); - self.vi_mode_cursor.point.line = min(vi_point.line, Line(num_lines as i32 - 1)); + let viewport_bottom = Line(-(self.grid.display_offset() as i32)); + let viewport_top = viewport_bottom + self.bottommost_line(); + self.vi_mode_cursor.point.line = max(min(vi_point.line, viewport_top), viewport_bottom); + self.vi_mode_cursor.point.column = min(vi_point.column, self.last_column()); // Reset scrolling region. self.scroll_region = Line(0)..Line(self.screen_lines() as i32); |