diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 06:47:48 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 07:16:43 -0300 |
| commit | 528c5a28ac3b813a2d0c06a019d7758476257915 (patch) | |
| tree | 777dd00892ea0d8ef690e8a646c2a8f93b7414fa /src/ninep/ctl.zig | |
| parent | 24dbdf73f92cd0a4b5ba130abe182cbcf9b3e472 (diff) | |
| download | pardes-528c5a28ac3b813a2d0c06a019d7758476257915.tar.gz pardes-528c5a28ac3b813a2d0c06a019d7758476257915.zip | |
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 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 23 |
1 files changed, 23 insertions, 0 deletions
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); +} |
