summaryrefslogtreecommitdiff
path: root/src/replica.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/replica.zig')
-rw-r--r--src/replica.zig33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/replica.zig b/src/replica.zig
index 330c3204..ef4ea39b 100644
--- a/src/replica.zig
+++ b/src/replica.zig
@@ -742,6 +742,8 @@ pub const Replica = struct {
pardes.dump.terminal_gpa = terminal.emulator_gpa;
defer pardes.dump.terminal_gpa = null;
const c = try pardes.dump.load(epoch, o, bytes, null);
+ // The chrome's colours are local, never dumped: the restored theme's.
+ pardes.colors.finishThemeInitialization(c);
// It runs no kind's code: its panes of a kind are Shadows.
c.kinds.ops = @splat(null);
// What loading queued (a watch, a theme asked for) is the
@@ -3741,6 +3743,37 @@ test "a replica joined from the session's dump replays the units after it" {
try std.testing.expectEqual(digestOf(a), r.digest());
}
+test "a replica joined from a themed dump paints its taglines in the restored theme" {
+ const gpa = std.testing.allocator;
+ const a = try Authority.init(gpa, .{ .cols = 80, .rows = 24, .file = "build.zig" }, TestHost.host(), false);
+ defer a.deinit();
+ _ = try a.local(.{ .command = "Theme rose_pine_moon" });
+ const was = Stepping.begin(&a.t, null);
+ const bytes = try pardes.dump.dumpBytes(a.core);
+ tape.resync(&a.t);
+ was.end();
+ defer a.core.gpa.free(bytes);
+ const r = try Replica.initDump(gpa, 1, 0, bytes, .{ .cols = 80, .rows = 24 });
+ defer r.deinit();
+ const expected = pardes.colors.ChromeTheme.fromTheme(a.core.theme());
+ try std.testing.expectEqualStrings("rose_pine_moon", r.core().theme().name);
+ try std.testing.expectEqual(expected.tag_bg, r.core().chromeTheme().tag_bg);
+ try std.testing.expectEqual(expected.tag_fg, r.core().chromeTheme().tag_fg);
+ r.draw(.{ .ctx = null, .f = null });
+ try std.testing.expectEqual(expected.tag_bg, r.core().surface.chrome.tag_bg);
+ try std.testing.expectEqual(expected.tag_fg, r.core().surface.chrome.tag_fg);
+ try std.testing.expectEqual(digestOf(a), r.digest());
+ // A later theme is an ordinary confirmed unit, its chrome set at once.
+ r.confirm(try a.local(.{ .command = "Theme monokai_pro_classic" }));
+ r.settle();
+ r.draw(.{ .ctx = null, .f = null });
+ const changed = pardes.colors.ChromeTheme.fromTheme(a.core.theme());
+ try std.testing.expectEqual(changed.tag_bg, r.core().surface.chrome.tag_bg);
+ try std.testing.expectEqual(changed.tag_fg, r.core().surface.chrome.tag_fg);
+ try std.testing.expect(r.diverged == null);
+ try std.testing.expectEqual(digestOf(a), r.digest());
+}
+
test "a host's Adopt and a terminal reader's failure are inputs: a replica makes the same pane" {
const gpa = std.testing.allocator;
// Its terminals as screen state, as a session's for its clients are.