From a0114d0b8be05d62bc1eb0e68642f7c31a766ade Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 08:18:25 -0300 Subject: 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 --- src/builtins.zig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/builtins.zig') 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 }); -- cgit v1.3