summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-30 23:48:44 -0300
committerGabriel Schneider <[email protected]>2026-10-30 23:54:48 -0300
commit3d4da8184f41307d8348f7e0595bba238e8976b4 (patch)
treeef65983504dc5614b92d29253825201015eac41d
parent793081277cb46143e3ccd80ae1d868febacf3fbd (diff)
downloadpardes-3d4da8184f41307d8348f7e0595bba238e8976b4.tar.gz
pardes-3d4da8184f41307d8348f7e0595bba238e8976b4.zip
panes: a pane's view (Pane.view, and a parked view's share of it) is digested and dumped, no longer derived: a key's move reads it before its step syncs (halfPageMove, ensureCursorVisible, through File.geometry), and a core loaded from a dump had the default, Wrap on and no row heights, so a window that joined after `SPC t w` scrolled further at the terminal view's next Ctrl-D (the box soak's `pane 23.file.scroll`, seed 7: win207-3 at its join); replica.zig's test, main's fails at `pane 0.file.scroll`
Co-Authored-By: Claude Opus 5.5 <[email protected]>
-rw-r--r--src/panes.zig5
-rw-r--r--src/replica.zig29
-rw-r--r--src/views.zig5
3 files changed, 36 insertions, 3 deletions
diff --git a/src/panes.zig b/src/panes.zig
index 20523de6..095e215f 100644
--- a/src/panes.zig
+++ b/src/panes.zig
@@ -29,7 +29,7 @@ pub const Pane = struct {
/// the pane's opens and readers; the other views' share of it (views.zig).
pub const replica = .{
.local = .{ "pv", "pv_known" },
- .derived = .{ "wrap_line", "wrap_col", "wrap_pad", "wrap_n", "body_wrapped", "context_rows", "body_rows", "body_visible_rows", "context_row_limit", "geometry_key", "geometry_len", "view", "notices", "pan" },
+ .derived = .{ "wrap_line", "wrap_col", "wrap_pad", "wrap_n", "body_wrapped", "context_rows", "body_rows", "body_visible_rows", "context_row_limit", "geometry_key", "geometry_len", "notices", "pan" },
.authority = .{"fs"},
.len = .{ .{ "msg", "msg_len" }, .{ "msg_older", "msg_older_len" }, .{ "question", "question_len" }, .{ "shell_tail", "shell_tail_len" }, .{ "sel_snap", "nsel_snap" } },
// A picture's and a PDF's memory is their own allocators' (a dump
@@ -268,6 +268,9 @@ pub const Pane = struct {
geometry_key: u64 = 0,
geometry_len: usize = 0,
/// The session's part of the geometry, as of the last step (`sync`).
+ /// Digested and dumped, not made again: a key's move reads it before its
+ /// step's `sync` (Text.halfPageMove's scroll), and a core loaded from a
+ /// dump has had none (Replica.initDump).
view: SessionView = .{},
sel: [3]Sel = @splat(.{}),
pointer_selections: [3]?PointerSelection = @splat(null),
diff --git a/src/replica.zig b/src/replica.zig
index 4f84712f..ca8612a9 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -4123,6 +4123,35 @@ test "a client that diverged joins again for its view: kept for it meanwhile, it
try agrees(a, back);
}
+test "a client joined from a dump moves through another view's pane as the session does, its lines not wrapped" {
+ 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 first client's Wrap off (SPC t w), and its cursor down into the
+ // file's long lines, near the bottom of its view.
+ var buf: [256]u8 = undefined;
+ var seq: u32 = 1;
+ const before = [_]pardes.Event{.{ .command = "Wrap" }} ++
+ @as([10]pardes.Event, @splat(.{ .key = .{ .cp = 'd', .ctrl = true } })) ++
+ @as([15]pardes.Event, @splat(.{ .key = .{ .cp = 'j', .text = "j" } }));
+ for (before) |ev| {
+ _ = try a.take(try inputOf(&buf, 1, seq, ev));
+ seq += 1;
+ }
+ // Another client joins, its view not live; the first's keys go on.
+ _ = try a.openView(2);
+ const joiner = try joinedNow(a, 3, 1);
+ defer joiner.deinit();
+ try std.testing.expectEqual(digestOf(a), joiner.digest());
+ for (0..3) |_| {
+ const u = try gpa.dupe(u8, try a.take(try inputOf(&buf, 1, seq, .{ .key = .{ .cp = 'd', .ctrl = true } })));
+ defer gpa.free(u);
+ seq += 1;
+ 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.
diff --git a/src/views.zig b/src/views.zig
index 58d7a1f7..b1786f83 100644
--- a/src/views.zig
+++ b/src/views.zig
@@ -80,8 +80,9 @@ pub const PaneView = struct {
cols: u16 = 1,
rows: u16 = 1,
- /// In a dump (`Dumped`): what a pane's step works out again.
- pub const replica = .{ .derived = .{ "view", "notices", "pan" } };
+ /// In a dump (`Dumped`): what a pane's step works out again. Its `view`
+ /// is dumped: the step after `unpark` reads it before it syncs.
+ pub const replica = .{ .derived = .{ "notices", "pan" } };
};
/// A view not live: its share of the session, and the serial of each pane