summaryrefslogtreecommitdiff
path: root/src/ninep/ctl.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 11:17:56 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commitab4bdfb9cbe2ee32889ad7b675dab1f5bfeae707 (patch)
treeb2b39529f76c33c26bdcd516ef90ca242922589c /src/ninep/ctl.zig
parentbe11a4e58e86d9b299accd3688c89d3c3a7b4b0c (diff)
downloadpardes-ab4bdfb9cbe2ee32889ad7b675dab1f5bfeae707.tar.gz
pardes-ab4bdfb9cbe2ee32889ad7b675dab1f5bfeae707.zip
A directory's +Search is found by its directory, the pane that ran the search included
Find and Grep passed over the pane they ran in when looking for the +Search to fill, so a Grep written to a +Search's own exec made a second one, and the two swapped roles on each run after. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
-rw-r--r--src/ninep/ctl.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index 9bb863cf..40a1a7cd 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1860,6 +1860,15 @@ test "Grep with no hit says grep: no match and opens nothing, a missing pane dir
try testing.expect(std.mem.indexOf(u8, found.file.?.content, "other.txt") != null);
try testing.expectEqual(grepped.serial, found.serial);
try testing.expect(std.mem.indexOf(u8, found.file.?.content, "bravo here") == null);
+ // A Grep run from the +Search itself fills that one, never a second.
+ try testing.expectEqual(Status.ok, wr(p, Node.of(found.serial, .exec), "Grep bravo\n").reply.status);
+ try testing.expectEqualStrings(try std.fmt.bufPrint(&line, "{d}\n", .{found.serial}), rd(p, root_exec, 0, 64).bytes);
+ var searches: usize = 0;
+ for (p.panes) |slot| if (slot) |q| if (q.file) |f| if (f.output != null) {
+ searches += @intFromBool(std.mem.endsWith(u8, f.path, "/+Search"));
+ };
+ try testing.expectEqual(@as(usize, 1), searches);
+ try testing.expect(std.mem.indexOf(u8, found.file.?.content, "bravo here") != null);
// A second pane in a directory that is not there.
const other = try th.newPane(p);
_ = wr(p, Node.of(other, .name), "/tmp/pardes-no-such-dir-zz/b.txt\n");