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/draw.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/draw.zig')
| -rw-r--r-- | src/draw.zig | 5 |
1 files changed, 1 insertions, 4 deletions
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 }; |
