diff options
Diffstat (limited to 'src/replica.zig')
| -rw-r--r-- | src/replica.zig | 29 |
1 files changed, 29 insertions, 0 deletions
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. |
