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/gui/gui.zig | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) (limited to 'src/gui') diff --git a/src/gui/gui.zig b/src/gui/gui.zig index 2533fbef..9768f2de 100644 --- a/src/gui/gui.zig +++ b/src/gui/gui.zig @@ -10330,14 +10330,10 @@ fn cursorBoxes(g: *const Gui, surface: *const pardes.Surface, layout: CellLayout const cursor = layer.cursor orelse continue; if (cursor.x >= layer.cols or cursor.y >= layer.rows) continue; const width: f32 = @floatFromInt(g.tagline_width); - const left = @as(f32, @floatFromInt(layer.viewport.x)) * layout.w; - const right = left + @as(f32, @floatFromInt(layer.viewport.w)) * layout.w; - // Past a full row's end the caret sits at the tag's right edge, as - // the grid's does (and the core's cursor box, draw.focusedCursorBox). - const x = @min(left + @as(f32, @floatFromInt(cursor.x)) * width, right - if (cursor.bar) @max(dp(1), width / 8) else width); + const span = layer.caretSpan(cursor.x, layout.w, width, if (cursor.bar) @max(dp(1), width / 8) else width); const y = layer.viewport.y + cursor.y; const top = @as(f32, @floatFromInt(y)) * layout.h + @as(f32, @floatFromInt(taglineBandOffset(y, win_h, g.cell_h, g.tagline_height))); - out[n] = .{ .x0 = x, .y0 = top, .x1 = @min(right, x + if (cursor.bar) @max(dp(1), width / 8) else width), .y1 = top + @as(f32, @floatFromInt(g.tagline_height)), .rgb = cursorColor(chrome, &layer.cells[@as(usize, cursor.y) * layer.cols + cursor.x], .tagline), .text = page, .bar = cursor.bar }; + out[n] = .{ .x0 = span[0], .y0 = top, .x1 = span[1], .y1 = top + @as(f32, @floatFromInt(g.tagline_height)), .rgb = cursorColor(chrome, &layer.cells[@as(usize, cursor.y) * layer.cols + cursor.x], .tagline), .text = page, .bar = cursor.bar }; n += 1; } return n; -- cgit v1.3