diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-24 21:10:15 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-24 21:10:17 -0300 |
| commit | b28053aede910b8714db4f27ef66e59dd96945c0 (patch) | |
| tree | a0aea3ca051a21cf3378de5d587357e9208deebb /core/Places.zig | |
| parent | abe3817e8dd0af41e6b5786bdbeb631219b58c23 (diff) | |
| download | pardes-b28053aede910b8714db4f27ef66e59dd96945c0.tar.gz pardes-b28053aede910b8714db4f27ef66e59dd96945c0.zip | |
Prompt: `/` and `?` search a file's body as they are typed (walk UI, pick-ui SPEC.md §7.3, item 2 of line E): its places found from where it began (Places.search, the view's on the key, a frame's budget a tick after), tinted, the current one stronger and selected as soon as it is found (`?`: the last before the caret, once the text between is searched), the gutter marked in the blank after each line number (`▸` the current place's line, `▪` the others'), counted `3/7 · 5 lines` (`3/⋯` while they are found; the lines counted once, at the step they are all found, a pass to the last place), ` · wrapped` past the end from where it began, `0` for no match; a pattern that is no regex keeps the last places, dimmed (Places.paint), the reason in the count; Enter lands, the pattern in `/`, and folds the pane's one search word into its trail (`/dirty/ 3/7`, Trail.setWord: the newest back step, in place of the one it had); n and N write it again in place and echo `/dirty/ 4/7 · line 112` on the message row, ` ↻` after a step round an end, `–/7` with the selection off its places, every step (Prompt.settle beside the places'); the first Esc in normal mode clears a search's tints (SPEC §10.4's first step: C's Esc order when it lands) and the word stays, dimmed (draw.zig, Trail.spanOf); Look on the word lights its places again and selects the one it was on, Exec searches again from the caret (Trail.lookStep, execStep); `*` makes the selection's pattern the search word, no prompt and no query pane; Alt-Enter keeps the places as rows: today's query pane (Query.open .text), the body as it was; `?` is helix's backward search, a new role (modal.zig, config.zig); THE FAULTS THE TESTS MET, both B's and latent until a word step was made: Trail.wordOf returned the text of a COPY of the step (a slice of its stack frame: the word drawn as garbage), now the step's own bytes; Trail.lastCur held `cur` under `n`, though keep() leaves a held pane's at `n` (a search word alone: the dump's load moved it and the digests differed), now `n`; TEST FIRST: Prompt.zig "/ searches the body as it is typed ..." and "? searches back from the caret ..."; Places' `*` test reads the echo, Query's and Stream's `/` tests keep their query pane by Alt-Enter, Query's `*` test reads the word; test/perf.zig --search measures a key in `/` and `s` on a 1 MB file; goldens fsearch, lookrange (the prompt in the tag, the word in the trail); core-test 1016/1182 (166 skipped), shell-test 1229/1232, pane-test 182/184, behaviour-test 274/277 (the failures A's, as on item 1), process-test A's six and none of mine, term-test 17/17, kitty-test 45/45
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/Places.zig')
| -rw-r--r-- | core/Places.zig | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/core/Places.zig b/core/Places.zig index 6c3ac9ab..4c04555b 100644 --- a/core/Places.zig +++ b/core/Places.zig @@ -664,8 +664,13 @@ pub fn paint(set: *Places, p: *Pardes, s: *Surface, pane: *Pane, r: pardes.Rect, if (!set.shows(pane)) return; const f = &pane.file.?; const th = p.theme(); - const strong = p.chromeTheme().search_bg; - const quiet = colors.mix(th.bg orelse th.tag_bg, strong); + var strong = p.chromeTheme().search_bg; + var quiet = colors.mix(th.bg orelse th.tag_bg, strong); + // A search prompt's pattern that is no regex: its last places, dimmed. + if (pardes.Prompt.dims(p, pane)) { + strong = quiet; + quiet = colors.mix(th.bg orelse th.tag_bg, quiet); + } const hits = set.hits.items; if (hits.len == 0) return; const nlines = File.nlines(p.gpa, f); @@ -792,11 +797,11 @@ test "places: * finds them all, n and N step them round the end silently, an edi try std.testing.expectEqual(@as(?usize, 1), set.current); typeKeys(p, "n"); try std.testing.expectEqual(@as(?usize, 2), set.current); - const logged = p.messages.len; typeKeys(p, "n"); try std.testing.expectEqual(@as(?usize, 0), set.current); - // round the end without a word anywhere - try std.testing.expectEqual(logged, p.messages.len); + // round the end: the search word says so, and the message row echoes + // it (Prompt.zig, pick-ui SPEC §7.3) + try std.testing.expect(std.mem.indexOf(u8, pane.msg[0..pane.msg_len], "1/3 ↻ · line 1") != null); typeKeys(p, "N"); try std.testing.expectEqual(@as(?usize, 2), set.current); |
