summaryrefslogtreecommitdiff
path: root/src/look.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/look.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/look.zig')
-rw-r--r--src/look.zig5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/look.zig b/src/look.zig
index 0baa9afc..f45fe583 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -667,7 +667,10 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, kind: Search, start
nrows += 1;
}
}
- if (!open_empty and nrows == 0) return 0;
+ // A Find or Grep that finds nothing empties its directory's +Search, if
+ // there is one, rather than leave the last search's rows looking like
+ // this one's.
+ if (!open_empty and nrows == 0 and (kind == .text or !panes.Output.hasFileSearch(p, dir))) return 0;
const content = try p.gpa.dupe(u8, out[0..out_len]);
// the buffer records WHICH search filled it, pattern and all: Find and
// Grep are builtins (words you can execute), the bare `/` is a key