1
0
Fork 0
mirror of https://github.com/alacritty/alacritty.git synced 2024-11-18 13:55:23 -05:00

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.
This commit is contained in:
Christian Duerr 2021-07-04 00:30:05 +00:00 committed by GitHub
parent c6ed855bfa
commit 9e7655ec03
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 2 deletions

View file

@ -18,6 +18,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
- Crash/Freezes with partially visible fullwidth characters due to alt screen resize
- Incorrect vi cursor position after invoking `ScrollPageHalfUp` action
- Slow PTY read performance with extremely dense grids
- Crash when resizing during vi mode
## 0.8.0

View file

@ -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);