mirror of
https://github.com/ghostty-org/ghostty.git
synced 2025-07-16 16:56:09 +03:00
handle case where cursor is past where content is on col shrink
This commit is contained in:
@ -689,14 +689,6 @@ pub fn resize(self: *Screen, alloc: Allocator, rows: usize, cols: usize) !void {
|
||||
i -= 1;
|
||||
}
|
||||
|
||||
// If our cursor was past the end of this line, move it
|
||||
// to the end of the contentful area.
|
||||
if (cursor_pos.y == iter.value - 1 and
|
||||
cursor_pos.x >= i)
|
||||
{
|
||||
cursor_pos.x = i - 1;
|
||||
}
|
||||
|
||||
break :trim row[0..i];
|
||||
};
|
||||
|
||||
@ -734,6 +726,18 @@ pub fn resize(self: *Screen, alloc: Allocator, rows: usize, cols: usize) !void {
|
||||
x += 1;
|
||||
}
|
||||
|
||||
// If our cursor is on this line but not in a content area,
|
||||
// then we just set it to be at the end.
|
||||
if (cursor_pos.y == iter.value - 1 and
|
||||
cursor_pos.x >= trimmed_row.len)
|
||||
{
|
||||
assert(new_cursor == null);
|
||||
new_cursor = .{
|
||||
.x = @minimum(cursor_pos.x, self.cols - 1),
|
||||
.y = y,
|
||||
};
|
||||
}
|
||||
|
||||
// If we aren't wrapping, then move to the next row
|
||||
if (trimmed_row.len == 0 or
|
||||
trimmed_row[trimmed_row.len - 1].attrs.wrap == 0)
|
||||
|
Reference in New Issue
Block a user