summaryrefslogtreecommitdiff
path: root/core/body_layer.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-26 13:07:24 -0300
committerGabriel Schneider <[email protected]>2026-11-26 13:07:25 -0300
commitc496956f395783085a249a4b1063abb577e4c3c2 (patch)
tree8384c07dfeca5ced5fc24f1da8c22990fac16662 /core/body_layer.zig
parent51f211d694beff9a389ab519f2286cef077adb81 (diff)
downloadpardes-c496956f395783085a249a4b1063abb577e4c3c2.tar.gz
pardes-c496956f395783085a249a4b1063abb577e4c3c2.zip
Pick, body_layer: a picker's landing-line mark (`▸` in the gutter and the hit ground, UX D7) is drawn where Enter lands, the row's own place, never at the preview's caret, which a click in the preview moves while the picker waits (W9's small fault, found in its S-kit shoot: after B1 in the preview pane the mark followed the clicked line while ⏎ landed on the row's place); THE CAUSE: Pick.landingLine answered `pane.body.cur_row`, the caret's line, which `preview` puts on the row's place and which nothing else moved while a picker held the keyboard; since UX DESIGN O2 (W9's olkkpllo) B1 in the preview gives that pane the keyboard and leaves the picker up and waiting, so the caret goes where the click is, and the mark with it, while `land` opens the row's place (look.open with the row's `at`); paintLandingSpan read the caret's column the same way (the Grep match it lights on the landing line); THE FIX: landingLine answers the row's place as `preview` and look.focusPaneLine put the caret there, its line (past the `Changes` layer's lines, a place past the file's end its first line) and its byte in the line, and paintLandingSpan takes that byte; RUN (TEST FIRST): Pick.zig "the landing line's mark shows where Enter lands, the row's own place, not the preview's caret: ..." opens a list from a held pane, its row long.zig:40:6 previewed in the made reader, B1 on line 43 of the preview (the caret there, the picker waiting) and asks `▸` and the hit ground on line 40's row and neither on the clicked one, then B1 on the head and Enter landing on line 40: fails on the merge at Pick.zig:3998 (the mark on the caret's row), passes now; the three tests that read landingLine read its `.line`; a user hit it with every click in a picker's preview pane since part O; GATES (Debug tui): core-test 1171/1346 (175 skipped: the merge's 1163/1338 + this test + the importer's 7 counted again after a cache wipe); load 1.9 to 2.2
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/body_layer.zig')
-rw-r--r--core/body_layer.zig14
1 files changed, 7 insertions, 7 deletions
diff --git a/core/body_layer.zig b/core/body_layer.zig
index 46a98760..8c156a84 100644
--- a/core/body_layer.zig
+++ b/core/body_layer.zig
@@ -332,9 +332,9 @@ pub fn renderBody(p: *Pardes, s: *Surface, arena: std.mem.Allocator, pane: *Pane
drawWrapMarkers(p, s, pane, r, tx, tw, body_h, pane_bg);
// A picker's landing line under the places it lights (UX D7).
const landing = pardes.Pick.landingLine(p, arena, pane);
- if (landing) |line| paintLanding(p, s, pane, r, tx, tw, body_h, line);
+ if (landing) |at| paintLanding(p, s, pane, r, tx, tw, body_h, at.line);
pane.places.paint(p, s, pane, r, body_h);
- if (landing) |line| paintLandingSpan(p, s, pane, r, f, line);
+ if (landing) |at| paintLandingSpan(p, s, pane, r, f, at.line, at.col);
pardes.Prompt.paintGutter(p, s, pane, r, body_h);
panes.Query.paint(p, s, pane, r, body_h);
} else if (pane.isTerminal()) {
@@ -688,14 +688,14 @@ fn paintLanding(p: *Pardes, s: *Surface, pane: *Pane, r: Rect, tx: u16, tw: u16,
}
}
-/// The landing line's matched span (a Grep's match at the row's column) as
-/// the current hit, solid in the hue with the page's ink, over the places
-/// lit on it (UX D7, R8).
-fn paintLandingSpan(p: *Pardes, s: *Surface, pane: *Pane, r: Rect, f: *panes.File.State, line: usize) void {
+/// The landing line's matched span (a Grep's match at the row's column,
+/// byte `col` of the line) as the current hit, solid in the hue with the
+/// page's ink, over the places lit on it (UX D7, R8).
+fn paintLandingSpan(p: *Pardes, s: *Surface, pane: *Pane, r: Rect, f: *panes.File.State, line: usize, col: usize) void {
if (!pane.places.shows(pane)) return;
const hits = pane.places.hits.items;
const ls = File.lineStart(p.gpa, f, line);
- const caret = ls + @as(usize, @intCast(@max(0, pane.body.cur_col)));
+ const caret = ls + col;
var i = panes.Places.firstFrom(hits, ls);
while (i < hits.len and hits[i].start <= caret) : (i += 1) {
if (hits[i].end <= caret) continue;