diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 10:03:10 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | df6106af80e13cc4f0121b7f2caf5315a4453a9d (patch) | |
| tree | beb1176f4b6cf13bb65732ccbf0d9f6e1049f605 /src/Output.zig | |
| parent | ae71c2e2845be4a5595e7fae117c0ef22c16c0c0 (diff) | |
| download | pardes-df6106af80e13cc4f0121b7f2caf5315a4453a9d.tar.gz pardes-df6106af80e13cc4f0121b7f2caf5315a4453a9d.zip | |
Find and Grep share one +Search a directory, each run replacing the last
Each Grep with a new pattern opened another +Search, until the column
refused panes. Find and Grep now reuse their directory's one, as acme
reuses +Errors, and the exec reads back the pane it filled; a plain
word's LookWord list search keeps a pane a pattern as before.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/Output.zig')
| -rw-r--r-- | src/Output.zig | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/Output.zig b/src/Output.zig index b32a40a2..37d25168 100644 --- a/src/Output.zig +++ b/src/Output.zig @@ -406,6 +406,16 @@ pub fn open(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: []const u return pane; } +/// Find and Grep share one +Search a directory, each run replacing what +/// the last showed, as acme reuses a directory's +Errors; a pane's own +/// search (LookWord list) keeps a pane a pattern. +fn fileSearch(from: Origin) bool { + return switch (from) { + .cmd => |c| c == .Find or c == .Grep, + else => false, + }; +} + pub fn fillResults(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: []const u8, content: []u8, initial_anchor: ?usize) !void { var result_content = content; errdefer p.gpa.free(result_content); @@ -448,9 +458,12 @@ pub fn fillResults(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: [] const rp = slot orelse continue; const rf = if (rp.file) |*f| f else continue; const o = if (rf.output) |*x| x else continue; - if (!std.meta.eql(o.from, from)) continue; - if (by_arg and !std.mem.eql(u8, o.arg(), arg)) continue; + const shared = fileSearch(from) and fileSearch(o.from); + if (!shared and !std.meta.eql(o.from, from)) continue; + if (!shared and by_arg and !std.mem.eql(u8, o.arg(), arg)) continue; if (!std.mem.eql(u8, std.fs.path.dirname(rf.path) orelse "", dir)) continue; + o.from = from; + p.fs.refilled = rp.serial; try setArg(o, arg); if (std.mem.eql(u8, rf.content, result_content)) { p.gpa.free(result_content); |
