summaryrefslogtreecommitdiff
path: root/core/term/terminal.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-21 01:00:47 -0300
committerGabriel Schneider <[email protected]>2026-11-21 01:08:24 -0300
commit76565c605defb03ab6aa8300b93f306054a67efd (patch)
tree706cc64e23ae33ec6be1d6b9164750ba42da712b /core/term/terminal.zig
parent6d937cd125ca04a2edb92b2d014014ee6c2eb45d (diff)
parentdac87eaa1d57acfc5b2dd8427e7fbacfe065e613 (diff)
downloadpardes-76565c605defb03ab6aa8300b93f306054a67efd.tar.gz
pardes-76565c605defb03ab6aa8300b93f306054a67efd.zip
integration: the terminals' side line on the landed main: pardes-term-join-4 (terminals by the pty's bytes: a client's emulator fed the session's bytes, reload at a join, the lag bound; the query rows' paint decided on replicated state; views.park's leak; a view kept for its client's rejoin; C and Alt-C on a long text walking on from the row last tried: 306 G instructions to 194 M; the soak's witness and watchdog) and main (pardes-new-upgrade); seven conflicts: the wire's version (the side line's 24 is 26 here: 24 is the bye's close byte, 25 the 9P state), Peers' join (the view typed, the lag limit a field's default), a peer's end (the view's index; cut joins again), the client's and the soak's bye (the struct, again or lagged), daemon.py's WIRE; three more the compiler found (a test's view typed: its index where a u8 is asked)
Co-Authored-By: Claude Fable 5.2 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/term/terminal.zig')
-rw-r--r--core/term/terminal.zig31
1 files changed, 31 insertions, 0 deletions
diff --git a/core/term/terminal.zig b/core/term/terminal.zig
index e57193a6..1673a3d8 100644
--- a/core/term/terminal.zig
+++ b/core/term/terminal.zig
@@ -1792,3 +1792,34 @@ test "a join at a cut: every side reloaded from its own snapshot holds the same
// another terminal once heavy colour has pruned pages cut otherwise.
try std.testing.expectEqual(2, heavy_apart);
}
+
+test "wide characters filling a scrollback past its limit, reflowed: its snapshot loads to the same snapshot and hash, and goes on as the same terminal through more bytes and reflows" {
+ // The soak's `cat` (test/replicas.zig): source lines, one in a few
+ // hundred with wide characters (CJK, box drawing, ambiguous symbols),
+ // a full scrollback pruned a page at a time, reflowed at odd widths
+ // where a wide character meets the right edge.
+ const gpa = std.testing.allocator;
+ var out: std.Io.Writer.Allocating = .init(gpa);
+ defer out.deinit();
+ const wide = " try writeText(notes, \"# Fallback faces and rules\\n\\n| name | glyphs |\\n|------|--------|\\n| cjk | \u{754C}\u{9762}\u{5B57} |\\n| sym | \u{222E} \u{2260} \u{2605} |\\n\\n\u{250C}\u{2500}\u{2500}\u{252C}\u{2500}\u{2500}\u{2510}\\n\u{2502} a\u{2502} b\u{2502}\\n\u{2514}\u{2500}\u{2500}\u{2534}\u{2500}\u{2500}\u{2518}\\n\");";
+ for (0..30000) |i| {
+ if (i % 7 == 3) try out.writer.print("{s}\r\n", .{wide}) else try out.writer.print("{s} {d}\r\n", .{ " const line = std.fmt.bufPrint(&buf, \"{d}\", .{i}) catch continue;"[0 .. 8 + i % 60], i });
+ }
+ const bytes = out.written();
+ const stops: [2]usize = .{ bytes.len / 3, 2 * bytes.len / 3 };
+ const first = try openKeeping(gpa, 121, 40, 1 << 20);
+ defer close(first);
+ feedReflowing(first, bytes, 0, bytes.len / 2, stops);
+ const snap = try snapshotOf(gpa, first);
+ defer gpa.free(snap);
+ const loaded = try load(gpa, snap, &parts(first));
+ defer close(loaded);
+ const again = try snapshotOf(gpa, loaded);
+ defer gpa.free(again);
+ try std.testing.expectEqualSlices(u8, snap, again);
+ try std.testing.expectEqual(joinHash(snap), try reload(first));
+ try expectSame(gpa, first, loaded);
+ feedReflowing(first, bytes, bytes.len / 2, bytes.len, stops);
+ feedReflowing(loaded, bytes, bytes.len / 2, bytes.len, stops);
+ try expectSame(gpa, first, loaded);
+}