fix y pos on resize

This commit is contained in:
Mitchell Hashimoto
2022-09-03 12:25:26 -07:00
parent 41f2b756ae
commit 2583b8cb65

View File

@ -849,7 +849,7 @@ pub fn resizeWithoutReflow(self: *Screen, rows: usize, cols: usize) !void {
// the same scrollback.
const old_cursor_y_screen = RowIndexTag.active.index(old.cursor.y).toScreen(&old).screen;
self.cursor.x = @minimum(old.cursor.x, self.cols - 1);
self.cursor.y = if (old_cursor_y_screen < RowIndexTag.screen.maxLen(self))
self.cursor.y = if (old_cursor_y_screen <= RowIndexTag.screen.maxLen(self))
old_cursor_y_screen - self.history
else
self.rows - 1;