summaryrefslogtreecommitdiff
path: root/src/builtins.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 08:18:25 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commita0114d0b8be05d62bc1eb0e68642f7c31a766ade (patch)
treed96c79f59b6d852608e889e68a647813da896bdc /src/builtins.zig
parent4a7d377d160cd95c89acad2abaf08bc533ff02a8 (diff)
downloadpardes-a0114d0b8be05d62bc1eb0e68642f7c31a766ade.tar.gz
pardes-a0114d0b8be05d62bc1eb0e68642f7c31a766ade.zip
Grep with no hit says grep: no match, and a pane directory that is not there is passed over
Grep walks every pane's directory; one not there (a scratch named into a directory not made yet) failed the whole search with `file not found`. Such a root is passed over now, and a search that finds nothing says `grep: no match` and opens no empty +Search. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/builtins.zig')
-rw-r--r--src/builtins.zig3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/builtins.zig b/src/builtins.zig
index 3f4a680c..59fc140d 100644
--- a/src/builtins.zig
+++ b/src/builtins.zig
@@ -1339,7 +1339,8 @@ pub const Grep = struct {
pub fn run(c: Ctx) void {
const pat = std.mem.trim(u8, c.arg orelse "", " \t\r\n");
if (pat.len > 0) {
- _ = look.runSearch(c.p, c.id, pat, .grep, .top, true) catch |err| c.p.reportError(c.id, "grep", err);
+ const rows = look.runSearch(c.p, c.id, pat, .grep, .top, false) catch |err| return c.p.reportError(c.id, "grep", err);
+ if (rows == 0) c.p.reportFailure(c.id, "grep: no match");
return;
}
c.p.startPrompt(c.pane, &c.pane.body, .{ .search = config.grep_marker });