diff options
Diffstat (limited to 'core/Output.zig')
| -rw-r--r-- | core/Output.zig | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/core/Output.zig b/core/Output.zig index 1335d8e9..42341002 100644 --- a/core/Output.zig +++ b/core/Output.zig @@ -721,17 +721,22 @@ pub fn isWalkRow(file: *const File.State, row: usize, line: []const u8) bool { pub fn openFonts(p: *Pardes, id: usize) !void { if (builtins.capabilities.font_picker) { - const arena = p.scratch.allocator(); - const font_list = fonts.list(arena, null); - var out: std.Io.Writer.Allocating = .init(p.gpa); - errdefer out.deinit(); - for (font_list) |f| - try out.writer.print(comptime config.Runtime.findAction(.font).?.word ++ " {s}\n", .{f.name}); - const content = try out.toOwnedSlice(); + // The session's machine's fonts, a question to its disk: a client's + // replay takes the session's answer, never its own. + const content = try pardes.tape.site(.fonts, p.gpa, fontsListed, .{ p.gpa, p.scratch.allocator() }); try openStepped(p, id, .{ .cmd = .Fonts }, content); } } +/// This machine's fonts, a `Font <name>` line each, in `gpa`. +fn fontsListed(gpa: std.mem.Allocator, arena: std.mem.Allocator) anyerror![]u8 { + var out: std.Io.Writer.Allocating = .init(gpa); + errdefer out.deinit(); + for (fonts.list(arena, null)) |f| + try out.writer.print(comptime config.Runtime.findAction(.font).?.word ++ " {s}\n", .{f.name}); + return out.toOwnedSlice(); +} + fn openStepped(p: *Pardes, id: usize, from: Origin, content: []u8) !void { errdefer p.gpa.free(content); const pane = p.panes[id] orelse return error.MissingPane; |
