mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
fix crash with cursor going off screen on resize
This commit is contained in:
@ -1716,7 +1716,8 @@ pub fn resizeWithoutReflow(self: *Screen, rows: usize, cols: usize) !void {
|
||||
// The cursor is normally in active coordinates, but by converting to
|
||||
// screen we can accomodate keeping it on the same place if we retain
|
||||
// the same scrollback.
|
||||
const old_cursor_y_screen = RowIndexTag.active.index(old.cursor.y).toScreen(&old).screen;
|
||||
const old_y = @max(old.cursor.y, old.rows - 1);
|
||||
const old_cursor_y_screen = RowIndexTag.active.index(old_y).toScreen(&old).screen;
|
||||
self.cursor.x = @min(old.cursor.x, self.cols - 1);
|
||||
self.cursor.y = if (old_cursor_y_screen <= RowIndexTag.screen.maxLen(self))
|
||||
old_cursor_y_screen -| self.history
|
||||
|
Reference in New Issue
Block a user