summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/look.zig b/src/look.zig
index 87dcede3..ba022bef 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -612,8 +612,14 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, kind: Search, start
roots[nroots] = d;
nroots += 1;
}
+ // A pane's directory that is not there (a scratch named into one
+ // not made yet, a peer's) has nothing to grep: passed over, not the
+ // search's failure.
for (roots[0..nroots]) |r|
- out_len += try filesystem.grep(arena, p.gpa, r, dir, pat, out[out_len..]);
+ out_len += filesystem.grep(arena, p.gpa, r, dir, pat, out[out_len..]) catch |err| switch (err) {
+ error.FileNotFound, error.NotDir, error.AccessDenied => continue,
+ else => return err,
+ };
} else if (kind == .find) {
out_len = try filesystem.find(arena, dir, pat, out);
} else if (pane.hasPdf()) {
@@ -655,7 +661,7 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, kind: Search, start
nrows += 1;
}
}
- if (!open_empty and kind == .text and nrows == 0) return 0;
+ if (!open_empty and (kind == .text or kind == .grep) and nrows == 0) 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