diff options
Diffstat (limited to 'core/builtins.zig')
| -rw-r--r-- | core/builtins.zig | 9 |
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); } }; |
