summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/draw.zig6
1 files changed, 5 insertions, 1 deletions
diff --git a/core/draw.zig b/core/draw.zig
index 8198e2ff..5263f7bf 100644
--- a/core/draw.zig
+++ b/core/draw.zig
@@ -279,7 +279,11 @@ fn joinNotice(p: *Pardes, s: *Surface, arena: std.mem.Allocator, region: Region)
// A notice wider than its band has less padding than the band hides.
for (skip..@max(skip, @min(pad, skip + chip))) |col| s.at(region.rect.x + @as(u16, @intCast(col - skip)), region.rect.y).style.fg = .default;
if (layer.cursor) |caret| {
- if (caret.x >= skip) s.cursor = .{ .x = region.rect.x + caret.x - @as(u16, @intCast(skip)), .y = region.rect.y, .bar = caret.bar };
+ // Counted wide: a band of 65535 glyphs (Layer.capacity's bound, which
+ // a frontend's row metrics reach) puts its caret past u16, and past
+ // the grid, where it is not drawn.
+ const x = @as(u32, region.rect.x) + caret.x;
+ if (caret.x >= skip and x - skip < s.cols) s.cursor = .{ .x = @intCast(x - skip), .y = region.rect.y, .bar = caret.bar };
}
}