diff options
Diffstat (limited to 'src/ninep')
| -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(); |
