summaryrefslogtreecommitdiff
path: root/src/Output.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 11:18:33 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit53fcf030b175fc035e62d1d471c01c2e0caefc9e (patch)
tree0539c39a8e8e63216269d79220c7c11bf59f85ea /src/Output.zig
parent23ff1aa588c5dfcb194543c949ebd87cbb12e725 (diff)
downloadpardes-53fcf030b175fc035e62d1d471c01c2e0caefc9e.tar.gz
pardes-53fcf030b175fc035e62d1d471c01c2e0caefc9e.zip
A Find or Grep that finds nothing empties its directory's +Search
It failed with no match but left the last search's rows in the +Search, where they read as this one's. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/Output.zig')
-rw-r--r--src/Output.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/src/Output.zig b/src/Output.zig
index 99246b4a..eb9e8db4 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -418,6 +418,16 @@ pub fn open(p: *Pardes, id: usize, dir: []const u8, from: Origin, arg: []const u
/// 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.
+/// Whether `dir` has its Find/Grep +Search open.
+pub fn hasFileSearch(p: *Pardes, dir: []const u8) bool {
+ for (p.panes) |slot| {
+ const f = (slot orelse continue).file orelse continue;
+ const o = f.output orelse continue;
+ if (fileSearch(o.from) and std.mem.eql(u8, std.fs.path.dirname(f.path) orelse "", dir)) return true;
+ }
+ return false;
+}
+
fn fileSearch(from: Origin) bool {
return switch (from) {
.cmd => |c| c == .Find or c == .Grep,