diff options
| -rw-r--r-- | src/dump.zig | 3 | ||||
| -rw-r--r-- | src/terminal.zig | 6 | ||||
| -rw-r--r-- | test/snapshots/dump.golden | 3 |
3 files changed, 12 insertions, 0 deletions
diff --git a/src/dump.zig b/src/dump.zig index fa21eaa4..ca3751f2 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -189,6 +189,8 @@ pub const Terminal = struct { /// replays faithfully only if it holds the whole session at one size. stream_is_screen: bool = false, cursor: Cursor = .{}, + /// Petscii on: its kitty graphics drawn as glyph art by choice. + petscii: bool = false, }; pub const LocationRow = struct { @@ -935,6 +937,7 @@ fn initDump(gpa: std.mem.Allocator, opts: Options, zon_bytes: []const u8, previo restored.command_status = t.status; } if (revive) p.emitSpawn(i, restored.serial, t.cwd); + if (t.petscii and pardes.panes.terminal.petscii(restored) == false) pardes.panes.terminal.togglePetscii(restored); break :terminal restored; }, .file => try pardes.panes.File.restore(p, i, src), diff --git a/src/terminal.zig b/src/terminal.zig index b7872d4e..80b9455c 100644 --- a/src/terminal.zig +++ b/src/terminal.zig @@ -1740,6 +1740,7 @@ pub fn dumpPane( .stream = stream[0..len], .stream_b64 = try dump.encodeBytes(arena, try screenVt(pane, arena)), .stream_is_screen = true, + .petscii = petscii(pane) orelse false, .cursor = .{ .col = pane.terminal.?.vt.screens.active.cursor.x, .row = pane.terminal.?.vt.screens.active.cursor.y, @@ -3086,6 +3087,11 @@ test "without pixels, or by the Petscii builtin, a terminal's image is glyph art try std.testing.expectEqual(@as(usize, 0), imagePlaces(s).len); try std.testing.expect(painted(s.at(tx, y))); try std.testing.expect(std.mem.indexOf(u8, try tagline.tagPrefix(p, pane), " petscii:on") != null); + // Dumped and restored, it is still glyph art. + try pardes.dump.dumpState(p); + const restored = try pardes.dump.restore(p, p.dump_out.?, "/tmp/pardes.dump.zon"); + defer restored.deinit(); + try std.testing.expectEqual(@as(?bool, true), petscii(restored.panes[0].?)); try std.testing.expect(p.executeBuiltinLine(0, "Petscii")); _ = frame.reset(.retain_capacity); s = try p.render(frame.allocator()); diff --git a/test/snapshots/dump.golden b/test/snapshots/dump.golden index b9608741..ea6e5912 100644 --- a/test/snapshots/dump.golden +++ b/test/snapshots/dump.golden @@ -46,6 +46,7 @@ .stream_b64 = <elided> .stream_is_screen = true, .cursor = .{ .col = 2, .row = 2 }, + .petscii = false, }, .file = null, .image = null, @@ -70,6 +71,7 @@ .stream_b64 = <elided> .stream_is_screen = true, .cursor = .{ .col = 2, .row = 2 }, + .petscii = false, }, .file = null, .image = null, @@ -94,6 +96,7 @@ .stream_b64 = <elided> .stream_is_screen = true, .cursor = .{ .col = 2, .row = 2 }, + .petscii = false, }, .file = null, .image = null, |
