diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 12:43:17 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | a98fca4546e5b99de07193297bac04abc85ab4ad (patch) | |
| tree | 9ed032442f6d767b2ea1104e06a62c3a4b7b3965 /src/ninep/ctl.zig | |
| parent | 137adecd03be209901efb228d9288282bc36c8de (diff) | |
| download | pardes-a98fca4546e5b99de07193297bac04abc85ab4ad.tar.gz pardes-a98fca4546e5b99de07193297bac04abc85ab4ad.zip | |
A Jumplist entry is (closed) only while no pane has its file open
A closed file's entries stayed closed after the file was opened again another way (a look, Recent), so Jumplist said (closed) of an open file and a step onto it reopened it. They are now that pane's as soon as a pane shows the file.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 3d7ee91a..b93d83c3 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -2348,6 +2348,32 @@ test "a column takes panes until their documented minimums fill it, not until no } } +test "a Jumplist entry is (closed) only while no pane has its file open" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + var tmp = testing.tmpDir(.{}); + defer tmp.cleanup(); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "a.txt", .data = "one\n" }); + try tmp.dir.writeFile(testing.io, .{ .sub_path = "b.txt", .data = "two\n" }); + var dir_buf: [4096]u8 = undefined; + const dir = dir_buf[0..try tmp.dir.realPath(testing.io, &dir_buf)]; + var line: [4200]u8 = undefined; + _ = wr(p, root_look, try std.fmt.bufPrint(&line, "{s}/a.txt\n", .{dir})); + p.sync(); + const a = p.panes[p.active].?.serial; + _ = wr(p, root_look, try std.fmt.bufPrint(&line, "{s}/b.txt\n", .{dir})); + p.sync(); + _ = wr(p, Node.of(a, .ctl), "Del\n"); + p.sync(); + var closed: usize = 0; + for (p.jumps[0..p.njumps]) |j| closed += @intFromBool(j.serial == 0); + try testing.expect(closed > 0); + // Open again, by a look: no entry is closed any more. + _ = wr(p, root_look, try std.fmt.bufPrint(&line, "{s}/a.txt\n", .{dir})); + p.sync(); + for (p.jumps[0..p.njumps]) |j| try testing.expect(j.serial != 0); +} + test "a closed file is found again: Recent and /recent list it closed, a look at its row reopens it at its dot, and a jump back does too" { const p = try withFile(testing.allocator, "x\n"); defer p.deinit(); |
