summaryrefslogtreecommitdiff
path: root/core/builtins.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-24 21:10:48 -0300
committerGabriel Schneider <[email protected]>2026-11-24 21:10:58 -0300
commit9d7f1c626687454cd2d8431aa8f6c905efd7ce97 (patch)
tree9a2c82edc4d7faaf70119f48f101bcfeaf5b2470 /core/builtins.zig
parent3621482c586b1d0d3601a1668a307918f1faea93 (diff)
downloadpardes-9d7f1c626687454cd2d8431aa8f6c905efd7ce97.tar.gz
pardes-9d7f1c626687454cd2d8431aa8f6c905efd7ce97.zip
Pick: the entry points open a picker in the tag (walk UI, pick-ui SPEC.md §14.3 phase 4, item 5 of line D): in a session whose jumps walk, from the keyboard or a click (Pick.asked: never a 9P script's, which keeps the query pane whose rows it reads back and whose `not found` it hears), Find and Grep (`SPC f f`, `SPC f g`, their words), Recent (`SPC f r`), Search's sources (`SPC b b` Panes, `SPC s s` Symbols, `SPC /` All), Panes, Jumplist (`SPC j l`) and the language server's symbols and diagnostics (`SPC l s`, `l S`, `l d`, `l D`: lsp/Ask.zig, a list picker titled by its word) unroll in the tag of the pane their Enter lands in; `Jumps new-pane` (still the default) keeps today's query pane and +Jumps, so no golden moves; `/` in a body stays today's; two fixes to the items before: the band is as tall as its second step (the acts and what they act on, the sources), and with the preview off (M-p) no frame is asked for it (Pick.busy spun every frame); test/perf.zig `--pick`: a key in a Find of 50,000 paths and its frame, the frames after it while the names are scored, a cursor move over files and the frame after it that loads the preview, instructions and time; TEST FIRST: Pick.zig "pick-ui §14.3 phase 4: SPC f f from a held pane opens in its reader and Esc removes it; from a reading pane it unrolls there; Enter lands as a step leaving the list word; n walks; a Look on the word reopens it with its cursor and marks"; core-test 0 failed; pane-test 182/184 and behaviour-test (and --replay) 274/277, process-test 5 of 146 failed: all the base's (A's tests not updated in this base: Help's +Help, window mode, a PDF's SPC; the goldens find, tagnav, builtins, leader, ttyhelp of A's report), shell-test, term-test, kitty-test pass
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'core/builtins.zig')
-rw-r--r--core/builtins.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/core/builtins.zig b/core/builtins.zig
index 589915c2..52e4ce1d 100644
--- a/core/builtins.zig
+++ b/core/builtins.zig
@@ -1801,6 +1801,7 @@ pub const Grep = struct {
/// stays, its count 0; the write hears `not found`.
fn search(c: Ctx, source: panes.Query.Source, miss: []const u8) void {
const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n");
+ if (pardes.Pick.asked(c.p)) return pardes.Pick.open(c.p, c.id, if (source == .find) .find else .grep, "", pat, "");
const reused = panes.Query.ofOwner(c.p, c.pane.serial) != null;
panes.Query.open(c.p, c.id, source, pat, pat.len == 0);
if (pat.len == 0 or !c.p.fs.serving) return;
@@ -1823,6 +1824,11 @@ pub const Search = struct {
pub fn run(c: Ctx) void {
const line = std.mem.trim(u8, c.arg orelse "", " \t\r\n");
const asked = panes.Query.parse(line) orelse panes.Query.parse(std.mem.concat(c.p.scratch.allocator(), u8, &.{ "/", line }) catch return).?;
+ // `SPC b b`, `SPC s s`, `SPC /` and the like: a picker in the tag.
+ if (pardes.Pick.asked(c.p)) switch (asked.source) {
+ inline .find, .grep, .recent, .panes, .symbols, .all => |s| return pardes.Pick.open(c.p, c.id, @field(pardes.Pick.Source, @tagName(s)), "", asked.pat, ""),
+ else => {},
+ };
panes.Query.open(c.p, c.id, asked.source, asked.pat, true);
}
};
@@ -1844,6 +1850,7 @@ pub const Panes = struct {
pub const takes_arg = true;
pub const quiet = true;
pub fn run(c: Ctx) void {
+ if (pardes.Pick.asked(c.p)) return pardes.Pick.open(c.p, c.id, .panes, "", std.mem.trim(u8, c.arg orelse "", " \t\r\n"), "");
panes.Query.open(c.p, c.id, .panes, std.mem.trim(u8, c.arg orelse "", " \t\r\n"), true);
}
};
@@ -2072,6 +2079,7 @@ pub const Recent = struct {
// The query pane under the pane the keyboard is in, line 1
// `Recent `, typed into; what follows the word narrows the files.
if (c.p.panes[c.id] == null) return c.p.reportFailure(c.id, "Recent: open a pane to search from");
+ if (pardes.Pick.asked(c.p)) return pardes.Pick.open(c.p, c.id, .recent, "", std.mem.trim(u8, c.arg orelse "", " \t\r\n"), "");
panes.Query.open(c.p, c.id, .recent, std.mem.trim(u8, c.arg orelse "", " \t\r\n"), true);
}
};
@@ -2101,6 +2109,7 @@ pub const Jumplist = struct {
pub const scope: Scope = .session;
pub const output: OutputTraits = .{ .name = config.jumps_buffer, .steps = true, .locations = true };
pub fn run(c: Ctx) void {
+ if (pardes.Pick.asked(c.p)) return pardes.Pick.open(c.p, c.id, .jumplist, "", "", "");
panes.Output.openJumps(c.p, c.id) catch |err| c.p.reportError(.at(c.id), "jumplist", err);
}
};