diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-23 09:33:05 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-23 10:04:29 -0300 |
| commit | 339ebde8df16f79197c2fd469eedba5edec750c4 (patch) | |
| tree | 6c481746eb1e8e9830b1e96192491ea3ce6bc1bd /core | |
| parent | 37cc3104fe589ec7cd2a8a5dd398f0f89f412837 (diff) | |
| download | pardes-339ebde8df16f79197c2fd469eedba5edec750c4.tar.gz pardes-339ebde8df16f79197c2fd469eedba5edec750c4.zip | |
jump, walk: two jump entries in a row are one when the digest sees them the same (`walk.eql`: the digest of each, so what the walk leaves out, a Buf's bytes past its length, a cache, decides nothing), not by std.meta.eql's every byte: core/Jump.zig:207 took the dedupe on a text entry's `place` bytes, undefined (`.place = .{}`), the same 0xAA on every Debug process and each process's own on a release build, so a session and its client kept different jump lists and the client parted (both release soaks of the base, the witness naming `views[3].jumps`, `views[0].jumps`); the test of the change before passes (Debug)
Co-Authored-By: Claude Opus <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core')
| -rw-r--r-- | core/Jump.zig | 7 | ||||
| -rw-r--r-- | core/walk.zig | 9 |
2 files changed, 13 insertions, 3 deletions
diff --git a/core/Jump.zig b/core/Jump.zig index 66d0ba51..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,7 +362,7 @@ 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); diff --git a/core/walk.zig b/core/walk.zig index d870052d..898a7cf7 100644 --- a/core/walk.zig +++ b/core/walk.zig @@ -89,6 +89,15 @@ pub fn digest(comptime T: type, v: *const T) u64 { return h.final(); } +/// Equal as the digest sees them: what the walk leaves out (a Buf's bytes +/// past its length, a cache) is not compared. std.meta.eql compares every +/// byte of an array, and those bytes are undefined: 0xAA on every Debug +/// process, each release process's own garbage; a decision of the core +/// taken on them agrees between a session and its clients in Debug alone. +pub fn eql(comptime T: type, a: *const T, b: *const T) bool { + return digest(T, a) == digest(T, b); +} + /// A digest of each field `hash` would walk, in order (what a divergence /// is narrowed down by); `names` are theirs. pub fn fieldDigests(comptime T: type, v: *const T, out: []u64) []u64 { |
