summaryrefslogtreecommitdiff
path: root/src/look.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:00:11 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commite0a2fd56777cf0f571125650ec74e75c3f6a8c44 (patch)
treeee4c5e993e73b922c49e5b8e792d088f7219a7fa /src/look.zig
parentf41599385cc0ee990954b32eca79984d54d0c5e3 (diff)
downloadpardes-e0a2fd56777cf0f571125650ec74e75c3f6a8c44.tar.gz
pardes-e0a2fd56777cf0f571125650ec74e75c3f6a8c44.zip
Grep and Find count the rows they found, so a hit opens its +Search and a miss fails
Round 18 made a search that found nothing fail, but grep and find never counted their rows (only a pane search did), so every Grep read as a miss. Both count the lines they wrote now; a Find or Grep that finds nothing fails alike, `find: no match, not found` / `grep: ...`, ENOENT, and opens no empty +Search. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/look.zig')
-rw-r--r--src/look.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/look.zig b/src/look.zig
index ba022bef..fa86aee4 100644
--- a/src/look.zig
+++ b/src/look.zig
@@ -620,8 +620,10 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, kind: Search, start
error.FileNotFound, error.NotDir, error.AccessDenied => continue,
else => return err,
};
+ nrows = std.mem.count(u8, out[0..out_len], "\n");
} else if (kind == .find) {
out_len = try filesystem.find(arena, dir, pat, out);
+ nrows = std.mem.count(u8, out[0..out_len], "\n");
} else if (pane.hasPdf()) {
if (comptime pdf_enabled) {
const found = try panes.Pdf.searchRows(
@@ -661,7 +663,7 @@ pub fn runSearch(p: *Pardes, id: usize, pat_raw: []const u8, kind: Search, start
nrows += 1;
}
}
- if (!open_empty and (kind == .text or kind == .grep) and nrows == 0) return 0;
+ if (!open_empty 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