summaryrefslogtreecommitdiff
path: root/src/dump.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-06 23:37:26 -0300
committerGabriel Schneider <[email protected]>2026-11-06 23:58:16 -0300
commitfd2c34a10911d6c577e429bfde4433e23c8eb6c7 (patch)
tree39d4a80110b29572aad35681817067c3ade8e3dd /src/dump.zig
parentdbff3a5bb1d47e5a348ce7e91073df43b29b3e44 (diff)
downloadpardes-fd2c34a10911d6c577e429bfde4433e23c8eb6c7.tar.gz
pardes-fd2c34a10911d6c577e429bfde4433e23c8eb6c7.zip
gui: a loaded session asks its host for its font again, as it does its ThemeFile: an Upgrade's process runs no startup config and the dump's font was already acknowledged, so the new window kept its built-in face at 27 px (Adwaita Mono, 1.5x the user's Go-Mono:18) and told the core that was the font in effect
Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNAtZenFv4weoMD3cge
Diffstat (limited to 'src/dump.zig')
-rw-r--r--src/dump.zig29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/dump.zig b/src/dump.zig
index b1711cf3..8aa4aa16 100644
--- a/src/dump.zig
+++ b/src/dump.zig
@@ -568,6 +568,12 @@ fn reviveSession(p: *Pardes, previous: ?*Pardes, resumed: bool) !void {
@memcpy(path[0..name.len], name);
colors.requestThemeFile(p, 0, path[0..name.len]);
}
+ // So is a Font: the face is the host's, and a new process (an Upgrade's,
+ // a start from a dump) has only its built-in one until it is asked.
+ if (p.settings.font.requested_path.get().len > 0) {
+ p.settings.font.pending = true;
+ p.font_request_taken = false;
+ }
for (p.panes) |slot| if (slot) |pane| {
pane.fs.unannounced = true;
};
@@ -837,6 +843,29 @@ test "an upgraded session's dump keeps its views and its running terminal as the
try std.testing.expect(r.panes[0].?.terminal.?.vt.screens.active_key == .primary);
}
+test "a loaded session asks its host for its font again: a new process has only its built-in face" {
+ const gpa = std.testing.allocator;
+ const p = try Pardes.init(gpa, .{ .tty_only = true });
+ defer p.deinit();
+ // The startup config's Font, taken and loaded by the window it ran in.
+ try std.testing.expect(p.settings.requestFont("/fonts/Go-Mono.ttf", "Go-Mono", 1800));
+ try std.testing.expectEqualStrings("/fonts/Go-Mono.ttf", p.takeFontRequest().?);
+ try std.testing.expect(p.acknowledgeFont("GoMono", 1800, .pixels));
+ try std.testing.expect(p.takeFontRequest() == null);
+ const bytes = try dumpBytes(p);
+ defer gpa.free(bytes);
+ // An Upgrade's process, which runs no startup config, and a start from
+ // the dump: each asks for the face again, at the size the request had.
+ var kept: [MAX_PANES]bool = @splat(false);
+ const q = try resumeFromDump(gpa, .{ .tty_only = true }, bytes, &kept);
+ defer q.deinit();
+ try std.testing.expectEqualStrings("/fonts/Go-Mono.ttf", q.takeFontRequest().?);
+ try std.testing.expectEqual(@as(u16, 1800), q.settings.font.requested_size_hundredths);
+ const r = try initFromDump(gpa, .{ .tty_only = true }, bytes);
+ defer r.deinit();
+ try std.testing.expectEqualStrings("/fonts/Go-Mono.ttf", r.takeFontRequest().?);
+}
+
test "a session's image, read by name as every load reads it, is the same session, and dumps to the same bytes again" {
const gpa = std.testing.allocator;
const p = try Pardes.init(gpa, .{ .tty_only = true });