summaryrefslogtreecommitdiff
path: root/core/Jump.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-23 16:17:21 -0300
committerGabriel Schneider <[email protected]>2026-11-23 16:17:21 -0300
commit8dd122b13ba8def974e8728734948e32e5e89e8e (patch)
treeb3e525ff0771f95473461694db6cb118ee8501ce /core/Jump.zig
parentf34d3a74cc4a6b735c98ce98cef0df42bd065e67 (diff)
parentde0b9a53ad18555708121b31a3dc813cbda8fa0e (diff)
downloadpardes-8dd122b13ba8def974e8728734948e32e5e89e8e.tar.gz
pardes-8dd122b13ba8def974e8728734948e32e5e89e8e.zip
integration: the installed tree (main = pardes-merge64, f34d3a74cc4a) and pardes-release-soak round 1 with its unfinished cheap jump equality on top (pardes-jump-eql-wip = mxkpuqwo on mntzqroy on zmxmqkmw): the base of pardes-release-soak round 2; no conflict
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/Jump.zig')
-rw-r--r--core/Jump.zig29
1 files changed, 26 insertions, 3 deletions
diff --git a/core/Jump.zig b/core/Jump.zig
index b68da32d..d85ff75a 100644
--- a/core/Jump.zig
+++ b/core/Jump.zig
@@ -203,8 +203,9 @@ pub fn trackJump(p: *Pardes) void {
};
}
// Two in a row the same (a closed one reopened beside its own,
- // or the entry between them gone): one entry, one step.
- if (w > 0 and std.meta.eql(v.jumps.list[w - 1], kept)) {
+ // or the entry between them gone): one entry, one step; the same
+ // as the digest sees them (a text's `place` is bytes undefined).
+ if (w > 0 and pardes.walk.eql(Loc, &v.jumps.list[w - 1], &kept)) {
if (i == v.jumps.cur) cur = w - 1;
continue;
}
@@ -361,12 +362,34 @@ test "the jump list never holds two entries in a row the same, when the one betw
p.view().jumps.cur = 3;
pane.body.cur_row = 80; // where you are now: far from both
trackJump(p);
- for (1..p.view().jumps.n) |i| try std.testing.expect(!std.meta.eql(p.view().jumps.list[i - 1], p.view().jumps.list[i]));
+ for (1..p.view().jumps.n) |i| try std.testing.expect(!pardes.walk.eql(Loc, &p.view().jumps.list[i - 1], &p.view().jumps.list[i]));
try std.testing.expectEqual(@as(usize, 3), p.view().jumps.n);
try std.testing.expectEqual(@as(u32, 1), p.view().jumps.list[0].line);
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();