From 0965773657b9d3cc6917cf980110509dcc82426f Mon Sep 17 00:00:00 2001 From: Christian Duerr Date: Thu, 10 Mar 2022 20:45:20 +0100 Subject: Fix crash when searching during reset This fixes a crash which occurs when the terminal is reset while searching, due to the vi mode cursor being outside of the visible area. This also fixes an issue where the search state reset would incorrectly clamp the vi mode cursor to the grid, rather than the absolute viewport position. While this fix does resolve all crashes when searching while running `cat /dev/urandom`, it does raise the question if manually clamping the vi mode cursor in every location where it is modified is the right choice. A follow-up to provide a safer API which guarantees correct modification of the vi mode cursor location is probably a good idea. Fixes #5942. --- alacritty/src/event.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'alacritty/src') diff --git a/alacritty/src/event.rs b/alacritty/src/event.rs index 1fd42fe6..6a14097a 100644 --- a/alacritty/src/event.rs +++ b/alacritty/src/event.rs @@ -853,10 +853,9 @@ impl<'a, N: Notify + 'a, T: EventListener> ActionContext<'a, N, T> { } // Reset display offset and cursor position. + self.terminal.vi_mode_cursor.point = self.search_state.origin; self.terminal.scroll_display(Scroll::Delta(self.search_state.display_offset_delta)); self.search_state.display_offset_delta = 0; - self.terminal.vi_mode_cursor.point = - self.search_state.origin.grid_clamp(self.terminal, Boundary::Grid); *self.dirty = true; } -- cgit