mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
fix some resize crashes
This commit is contained in:
@ -1133,7 +1133,7 @@ pub fn resize(self: *Screen, rows: usize, cols: usize) !void {
|
|||||||
// If our y is more than our rows, we need to scroll
|
// If our y is more than our rows, we need to scroll
|
||||||
if (y >= self.rows) {
|
if (y >= self.rows) {
|
||||||
try self.scroll(.{ .delta = 1 });
|
try self.scroll(.{ .delta = 1 });
|
||||||
y -= 1;
|
y = self.rows - 1;
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1179,8 +1179,8 @@ pub fn resize(self: *Screen, rows: usize, cols: usize) !void {
|
|||||||
// point and set it up.
|
// point and set it up.
|
||||||
if (new_cursor) |pos| {
|
if (new_cursor) |pos| {
|
||||||
const viewport_pos = pos.toViewport(self);
|
const viewport_pos = pos.toViewport(self);
|
||||||
self.cursor.x = viewport_pos.x;
|
self.cursor.x = @minimum(viewport_pos.x, self.cols - 1);
|
||||||
self.cursor.y = viewport_pos.y;
|
self.cursor.y = @minimum(viewport_pos.y, self.rows - 1);
|
||||||
} else {
|
} else {
|
||||||
// TODO: why is this necessary? Without this, neovim will
|
// TODO: why is this necessary? Without this, neovim will
|
||||||
// crash when we shrink the window to the smallest size. We
|
// crash when we shrink the window to the smallest size. We
|
||||||
|
Reference in New Issue
Block a user