From 53fcf030b175fc035e62d1d471c01c2e0caefc9e Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 11:18:33 -0300 Subject: 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 --- src/look.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/look.zig') 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 -- cgit v1.3