From 4f06c3ba5f985267ef589289b2b5e60220eeb4bf Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 5 Nov 2026 01:07:58 -0300 Subject: draw, gui: a tag caret's span is one Layer.caretSpan (past a full row's end it sits at the tag's right edge, where the grid's is clamped), which the core's focused cursor box and the window's caret both take, in place of the rule written in each with a comment pointing at the other Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge --- src/draw.zig | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) (limited to 'src/draw.zig') diff --git a/src/draw.zig b/src/draw.zig index b0fede3b..b2884641 100644 --- a/src/draw.zig +++ b/src/draw.zig @@ -197,10 +197,7 @@ fn focusedCursorBox(p: *const Pardes, s: *const Surface) ?animation.Box { if (layer.rows == 0 or layer.viewport.y + caret.y != cursor.y) continue; if (cursor.x < layer.viewport.x or cursor.x >= layer.viewport.x + layer.viewport.w) continue; const w = if (caret.bar) tw / bw / 8 else tw / bw; - // A caret past a full row's end sits at the tag's right edge, where - // the grid's is clamped too. - const right = @as(f32, @floatFromInt(layer.viewport.x + layer.viewport.w)); - const x = @min(@as(f32, @floatFromInt(layer.viewport.x)) + @as(f32, @floatFromInt(caret.x)) * tw / bw, right - w); + const x = layer.caretSpan(caret.x, 1, tw / bw, w)[0]; return .{ .x = x, .y = @as(f32, @floatFromInt(cursor.y)) + (bh - th) / 2 / bh, .w = w, .h = th / bh }; } return .{ .x = @floatFromInt(cursor.x), .y = @floatFromInt(cursor.y), .w = if (cursor.bar) 1.0 / 8.0 else 1, .h = 1 }; -- cgit v1.3