summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-31 00:46:29 -0300
committerGabriel Schneider <[email protected]>2026-10-31 00:46:37 -0300
commit94b282971453849eb567124c12bd801a82908392 (patch)
treeceeabeb5c9a9e5d3504b36657676e77555bfcfaf /src
parent0405db5de9e78af1fd6df04d25f461e435a943ae (diff)
downloadpardes-94b282971453849eb567124c12bd801a82908392.tar.gz
pardes-94b282971453849eb567124c12bd801a82908392.zip
locations: a row's colours are in no digest (a `digest` of Row's own; a dump keeps them): they are painted from what the process has painted, the owner's highlights a frame made and the locations cache, both derived, so a window joined from a dump made a `/` query's rows plain where its session had coloured them (the box soak's `pane 21.file.location_rows` at win207-4's `/r`, unit 4/447); replica.zig's test, main fails it at `pane 1.file.location_rows`
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/locations.zig13
-rw-r--r--src/replica.zig26
2 files changed, 39 insertions, 0 deletions
diff --git a/src/locations.zig b/src/locations.zig
index d0904607..b14b3a2c 100644
--- a/src/locations.zig
+++ b/src/locations.zig
@@ -24,6 +24,19 @@ pub const Row = struct {
location_end: usize,
code_start: usize,
colors: []u8 = &.{},
+
+ /// The replay digest's (src/walk.zig): all of it but its colours. They
+ /// are painted from what this process has painted (the owner's
+ /// highlights a frame made, the locations cache: both derived), so a
+ /// client joined from a dump, or one that drew another view, colours a
+ /// row its session left plain. They are how a row looks, not where it
+ /// points; a dump keeps them.
+ pub fn digest(r: *const Row, h: *pardes.walk.Hasher) void {
+ inline for (@typeInfo(Row).@"struct".field_names) |name| {
+ if (comptime std.mem.eql(u8, name, "colors")) continue;
+ pardes.walk.hash(@FieldType(Row, name), &@field(r, name), h);
+ }
+ }
};
/// Raw (no safe build's overwrite): a replica's rollback copy pins a row
diff --git a/src/replica.zig b/src/replica.zig
index ca8612a9..8cacb075 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -4152,6 +4152,32 @@ test "a client joined from a dump moves through another view's pane as the sessi
}
}
+test "a client joined from a dump makes a `/` query's rows as the session does, though only the session has drawn its owner" {
+ if (comptime !pardes.syntax.enabled) return error.SkipZigTest;
+ const gpa = std.testing.allocator;
+ const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "build.zig" }, TestHost.host(), false);
+ defer a.deinit();
+ // The session draws: its owner's colours painted for the view (File.refreshHighlights).
+ {
+ const was = Stepping.begin(&a.t, null);
+ defer was.end();
+ var arena: std.heap.ArenaAllocator = .init(gpa);
+ defer arena.deinit();
+ _ = try a.core.render(arena.allocator());
+ }
+ _ = try a.openView(2);
+ const joiner = try joinedNow(a, 3, 1);
+ defer joiner.deinit();
+ try std.testing.expectEqual(digestOf(a), joiner.digest());
+ var buf: [256]u8 = undefined;
+ for ("/co", 1..) |c, seq| {
+ const u = try gpa.dupe(u8, try a.take(try inputOf(&buf, 1, @intCast(seq), .{ .key = .{ .cp = c, .text = &.{c} } })));
+ defer gpa.free(u);
+ joiner.confirm(u);
+ try agrees(a, joiner);
+ }
+}
+
/// An input of a replica's in the session's order, as `Peers.input` takes
/// it: the terminals flushed to every peer, the step, the rows it read that
/// each peer holds as holes (`fill`), then its unit to every replica.