diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-25 00:44:54 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-25 01:05:40 -0300 |
| commit | 32f8f603f30a6e6e196da929fa0df82b8e94f4c1 (patch) | |
| tree | ed2a839e5aa06da9bd540cb1d9b46b165353fa43 /core/Pick.zig | |
| parent | ab4e13779ccda0ac5ce497fd2b706930e2f2845c (diff) | |
| download | pardes-32f8f603f30a6e6e196da929fa0df82b8e94f4c1.tar.gz pardes-32f8f603f30a6e6e196da929fa0df82b8e94f4c1.zip | |
Prompt, Pick: lines D's pickers and E's prompts work together where jumps walk (walk UI M3 item 2, pick-ui SPEC §7.2, §6.3, §7.3): Alt-Enter in a search (`/ ?`) or a sam prompt (`s S K A-K`) keeps the result as a list, a row a place (`path:line:col: text`, the text's leading blanks off, cut to 160 bytes, look.parsePathLine's form so the column lands too), the first Query.max_rows (2000) and a message saying how many there were past it: where jumps walk (Pick.asked: never a 9P script's) a picker of those rows (Pick.Source.list, titled by the prompt's plain word, `/dirty/` or `Edit x/dirty/`, cut to the picker's word at a character's start) in the tag of the pane its Enter lands in, the body as it was before the prompt, its Enter the list word `/dirty/ 3/7` in the trail; under `Jumps new-pane` a search keeps E's query pane (Query.open) and a sam prompt's selections are a +Search list (Output.fillResults), where before Alt-Enter in a sam prompt did nothing; the sam prompts' hints say `M-⏎ as a list` as the search's do; one owner for n and N (§6.3: the newest list or search word, or the one Looked at): a search's places answer n while they light its word (§7.3: tinted while it is the word n walks), so a list landed in the pane (Pick.listed, after Trail.through) puts a search's tints out, n then walking the list (D's walkList already gives way to a newer search word), and Look on the search word (Prompt.lookWord) lights it and takes n back; F's colors.previewTheme stays the one theme preview (no other in the tree; it is derived each step from the live themes picker, Pick.produceAll, so E2's `:theme ` either goes through Pick.Source.themes or derives it the same way); TEST FIRST: Prompt.zig "Alt-Enter in / or s keeps the result as a list ..." (failed before: no picker, Pick.live null), Pick.zig "n and N walk the newest list or search word, or the one Looked at ..." (failed before: the search's places still lit after the list landed, Pick.zig:1912, n stepping the search); E's `?` test loses its Alt-Enter tail (now in the new test, both routings), its `s` head test reads the new hint; five Query/Stream tests about today's query pane opened by Alt-Enter in `/` set `Jumps new-pane` (G's newpane.py); goldens: selregex and msg regenerated (process-test --update), each changed row the sam prompt's hint `⏎ select · M-⏎ as a list · C-r history · esc` and nothing else; tui core-test 1053/1223 (170 skipped, 0 failed); process-test 9 of 146 failed before the two updates: those two and item 1's seven left to item 3
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBFhdevVu48bvL9kCE
Diffstat (limited to 'core/Pick.zig')
| -rw-r--r-- | core/Pick.zig | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/core/Pick.zig b/core/Pick.zig index 6c86cb98..3bab0970 100644 --- a/core/Pick.zig +++ b/core/Pick.zig @@ -1161,6 +1161,9 @@ fn listed(p: *Pardes, pk: *const Pick) void { var w: Trail.Word = .{ .index = pk.id }; _ = wordOf(p, pk, &w.text); Trail.through(&pane.trail, .{ .list = w }); + // The newest list or search is the word n and N walk (SPEC §6.3): a + // search's tints go with it (§7.3: lit while it is n's). + if (pane.places.provenance == .search) pane.places.clear(p.gpa); } /// `n` and `N` in a reading pane whose trail's newest list or search word @@ -1894,3 +1897,31 @@ test "SPC t t is a picker of the themes in the asking pane's tag, the whole wind try std.testing.expect(p.theme_preview == null); try std.testing.expectEqualStrings(themes[shown].name, p.theme().name); } + +test "n and N walk the newest list or search word, or the one Looked at (SPEC §6.3, §7.3): a list landed after a search puts the search's tints out and n walks the list; Look on the search word lights it again and n steps its places" { + const p = try Pardes.init(std.testing.allocator, .{ .tty_only = true, .cols = 140, .rows = 40 }); + defer p.deinit(); + p.settings.jumps = .walk; + const pane = try p.setTestFile("dirty one\nclean\ndirty two\nclean\ndirty three\n"); + const id = p.view().active; + for ("/dirty") |c| p.update(.{ .key = .{ .cp = c, .text = &[_]u8{c} } }); + p.update(.{ .key = .{ .cp = Key.enter } }); + try std.testing.expect(pane.places.started); + // A list lands in the pane after the search: the list is n's. + open(p, id, .list, "Refs", "", "/test.txt:2:1 clean\n/test.txt:4:1 clean\n"); + landHere(p); + try std.testing.expectEqual(id, p.view().active); + try std.testing.expectEqual(@as(i32, 1), pane.body.cur_row); + try std.testing.expect(!pane.places.started); + p.update(.{ .key = .{ .cp = 'n', .text = "n" } }); + try std.testing.expectEqual(@as(i32, 3), pane.body.cur_row); + // Look on the search word: lit again, and n steps its places. + var i: u8 = 0; + while (i < pane.trail.n and pane.trail.steps[i] != .search) i += 1; + try std.testing.expect(i < pane.trail.n); + Trail.lookStep(p, id, i); + try std.testing.expect(pane.places.started); + const was = pane.places.current; + p.update(.{ .key = .{ .cp = 'n', .text = "n" } }); + try std.testing.expect(pane.places.current != null and !std.meta.eql(was, pane.places.current)); +} |
