From 528c5a28ac3b813a2d0c06a019d7758476257915 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 06:47:48 -0300 Subject: A second LookWord list look in a directory refills its +Search, as a terminal's word looks already did, rather than stacking another Each word looked at with LookWord list opened a +Search of its own in the same directory. Word looks now share the directory's one, the next word refilling it; a `/` search still keeps a +Search each. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'src/ninep/ctl.zig') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 70ed51a7..ad427cad 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -4165,3 +4165,26 @@ test "`@pN:` looks at pane N as `a.txt:` looks at a.txt, and a line past the end try testing.expect(std.mem.endsWith(u8, said, "/test.txt:99999 has no line 99999")); } } + +test "a second LookWord list look in a directory refills its +Search rather than stacking another" { + if (comptime !pardes.hosted) return; + const gpa = testing.allocator; + var tmp = testing.tmpDir(.{}); + defer tmp.cleanup(); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "words.txt", .data = "alpha beta\nalpha beta\n" }); + var dir_buf: [4096]u8 = undefined; + const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; + var path_buf: [4200]u8 = undefined; + const path = try std.fmt.bufPrint(&path_buf, "{s}/words.txt", .{dir}); + const p = try Pardes.init(gpa, .{ .file = path, .tty_only = true, .cols = 80, .rows = 30 }); + defer p.deinit(); + _ = wr(p, @intFromEnum(tree.TopFile.ctl), "LookWord list\n"); + pardes.look.lookAt(p, 0, "alpha"); + pardes.look.lookAt(p, 0, "beta"); + var searches: usize = 0; + for (p.panes) |slot| if (slot) |pn| if (pn.file) |f| if (std.mem.endsWith(u8, f.path, "+Search")) { + searches += 1; + try testing.expectEqualStrings("beta", f.output.?.arg()); + }; + try testing.expectEqual(@as(usize, 1), searches); +} -- cgit v1.3