diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-05 01:07:58 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-05 01:40:44 -0300 |
| commit | 4f06c3ba5f985267ef589289b2b5e60220eeb4bf (patch) | |
| tree | 1500f2d82cfcc914f177db7da05ab021c430a589 /src/gui/gui.zig | |
| parent | 813527001b1c9a87fa807c9e22c934b7d71acd05 (diff) | |
| download | pardes-4f06c3ba5f985267ef589289b2b5e60220eeb4bf.tar.gz pardes-4f06c3ba5f985267ef589289b2b5e60220eeb4bf.zip | |
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 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/gui/gui.zig')
| -rw-r--r-- | src/gui/gui.zig | 8 |
1 files changed, 2 insertions, 6 deletions
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; |
