when less cols, cursor needs to be in screen space, not viewport

This commit is contained in:
Mitchell Hashimoto
2022-08-08 17:44:13 -07:00
parent 113b5a318b
commit d551f1126b

View File

@ -745,7 +745,7 @@ pub fn resize(self: *Screen, alloc: Allocator, rows: usize, cols: usize) !void {
cursor_pos.x == i)
{
assert(new_cursor == null);
new_cursor = .{ .x = x, .y = y };
new_cursor = .{ .x = x, .y = self.visible_offset + y };
}
// Copy the old cell, unset the old wrap state
@ -766,7 +766,7 @@ pub fn resize(self: *Screen, alloc: Allocator, rows: usize, cols: usize) !void {
assert(new_cursor == null);
new_cursor = .{
.x = @minimum(cursor_pos.x, self.cols - 1),
.y = y,
.y = self.visible_offset + y,
};
}