diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/dump.zig | 29 |
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 }); |
