diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-24 11:57:26 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-24 11:57:35 -0300 |
| commit | 51903dd947f90381d1a908c488a019289a1c8413 (patch) | |
| tree | ab5b2574642493c60476e6e9bcd7cc0e1c5e8d9e /src/builtins.zig | |
| parent | 18d89dcedaed1f8437799621675e88ca47d7cdc1 (diff) | |
| download | pardes-51903dd947f90381d1a908c488a019289a1c8413.tar.gz pardes-51903dd947f90381d1a908c488a019289a1c8413.zip | |
Search converge 3/6: the query pane, line 1 the query and its first word the source, rows made live like Callstack's, the owner's places showing the set, a +Preview promoted in place, Enter freezes, Esc restores
Diffstat (limited to 'src/builtins.zig')
| -rw-r--r-- | src/builtins.zig | 35 |
1 files changed, 31 insertions, 4 deletions
diff --git a/src/builtins.zig b/src/builtins.zig index 1ec33d88..7cdee9de 100644 --- a/src/builtins.zig +++ b/src/builtins.zig @@ -210,7 +210,7 @@ pub const registry = struct { .toggle, .transition, .scene, .dump_dir, .choice, .lift, .shader_animation, .motion, .shell => false, .theme, .font, .tagline_size, .window_opacity, .window_blur, .message_ms, .shader, .inactive_dim, .grip_width => true, // bare, it says the current value (exec.applySettingBuiltin) - .tab, .callstack_depth => false, + .tab, .callstack_depth, .search_rows => false, }; return declOr(b, "requires_arg", false, false); } @@ -1721,7 +1721,8 @@ pub const Find = struct { if (rows == 0) c.p.reportFailure(c.id, e_search_miss_find); return; } - c.p.startPrompt(c.pane, &c.pane.body, .{ .search = config.find_marker }); + // Bare (SPC f f): the query pane, line 1 `Find `, typed into. + panes.Query.open(c.p, c.id, .find, "", true); } }; @@ -1738,7 +1739,29 @@ pub const Grep = struct { if (rows == 0) c.p.reportFailure(c.id, e_search_miss_grep); return; } - c.p.startPrompt(c.pane, &c.pane.body, .{ .search = config.grep_marker }); + // Bare (SPC f g): the query pane, line 1 `Grep `, typed into. + panes.Query.open(c.p, c.id, .grep, "", true); + } +}; + +/// Search in a query pane under this pane, line 1 the argument (`Panes`, +/// `Symbols lay`, `All needle`, `/re`, any of its words); bare, `/`. +pub const Search = struct { + pub const takes_arg = true; + pub const quiet = true; + 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).?; + panes.Query.open(c.p, c.id, asked.source, asked.pat, true); + } +}; + +/// Pick an open pane by its name in a query pane under this one (SPC b b). +pub const Panes = struct { + pub const takes_arg = true; + pub const quiet = true; + pub fn run(c: Ctx) void { + panes.Query.open(c.p, c.id, .panes, std.mem.trim(u8, c.arg orelse "", " \t\r\n"), true); } }; @@ -1866,9 +1889,13 @@ pub const Last = struct { /// List the files opened lately, closed ones too, each a place to open again. pub const Recent = struct { pub const scope: Scope = .session; + pub const takes_arg = true; pub const output: OutputTraits = .{ .name = config.recent_buffer, .steps = true, .locations = true }; pub fn run(c: Ctx) void { - panes.Output.openRecent(c.p, c.id) catch |err| c.p.reportError(c.id, "recent", err); + // From a pane: the query pane under it, line 1 `Recent `, typed + // into; from a header, which no pane owns, the +Recent list. + if (c.p.exec_header or c.p.panes[c.id] == null) return panes.Output.openRecent(c.p, c.id) catch |err| c.p.reportError(c.id, "recent", err); + panes.Query.open(c.p, c.id, .recent, std.mem.trim(u8, c.arg orelse "", " \t\r\n"), true); } }; |
