summaryrefslogtreecommitdiff
path: root/core/Jump.zig
diff options
context:
space:
mode:
Diffstat (limited to 'core/Jump.zig')
-rw-r--r--core/Jump.zig22
1 files changed, 22 insertions, 0 deletions
diff --git a/core/Jump.zig b/core/Jump.zig
index b68da32d..66d0ba51 100644
--- a/core/Jump.zig
+++ b/core/Jump.zig
@@ -367,6 +367,28 @@ test "the jump list never holds two entries in a row the same, when the one betw
try std.testing.expectEqual(@as(u32, 150), p.view().jumps.list[1].line);
}
+test "two entries the same but for the bytes past their place's length are one entry, as the digest sees them, on every build" {
+ const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 40 });
+ defer p.deinit();
+ const pane = try p.setTestFile(std.mem.asBytes(&@as([200][2]u8, @splat("a\n".*))));
+ // A text's entry has no place: `.place = .{}`, its bytes undefined,
+ // 0xAA on every Debug process and each release process's own (the
+ // stack's, a load's): one entry on every side or a client parts.
+ var a: Loc = .{ .pane = 0, .serial = pane.serial, .line = 1, .col = 1 };
+ var b = a;
+ @memset(&a.place.bytes, 0x11);
+ @memset(&b.place.bytes, 0x22);
+ p.view().jumps.list[0] = a;
+ p.view().jumps.list[1] = .{ .pane = 5, .serial = 999, .line = 1, .col = 1 };
+ p.view().jumps.list[2] = b;
+ p.view().jumps.list[3] = .{ .pane = 0, .serial = pane.serial, .line = 150, .col = 1 };
+ p.view().jumps.n = 4;
+ p.view().jumps.cur = 3;
+ pane.body.cur_row = 80;
+ trackJump(p);
+ try std.testing.expectEqual(@as(usize, 3), p.view().jumps.n);
+}
+
test "jump history skips an entry whose pane slot or serial is gone, leaving the selection" {
const p = try Pardes.init(std.testing.allocator, .{ .cols = 60, .rows = 12 });
defer p.deinit();