summaryrefslogtreecommitdiff
path: root/src/replica.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-10 02:00:44 -0300
committerGabriel Schneider <[email protected]>2026-11-10 02:00:44 -0300
commite6ea52e36cbb7c557681e6c7a55fa6f0d92f8754 (patch)
tree4a9d799e1d8e04dae68e2132b3ca223f4bf018fa /src/replica.zig
parent75db3e84e24ee75626074d93927261249b646386 (diff)
downloadpardes-e6ea52e36cbb7c557681e6c7a55fa6f0d92f8754.tar.gz
pardes-e6ea52e36cbb7c557681e6c7a55fa6f0d92f8754.zip
macos: a windowless gui authority follows its terminals' directories (pollCwds before the no-window return, upstream's test ported onto forkShell's seven arguments), and a replica joined from a dump paints the restored theme's chrome (initDump runs finishThemeInitialization: Core.chrome is local and was never recomputed, so the join showed the default theme's tags until the next Theme, as the ported test showed before the line)
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
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.