From 7ba54de4bd498c2a56ea3d0d43c88356759f7b1f Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Sun, 27 Sep 2026 22:34:56 -0300 Subject: Move saving and loading a whole editor out of pardes.zig into dump.zig Pure move, no behaviour change (acme keeps dump and load in rows.c): dumpState, restore, initFromDump and initDump go verbatim to the end of dump.zig, after the dump format they read and write. Inside dump.zig the moved code's `dump.` prefix drops, so `Pane` there is the dump record; the one editor pane it names is spelled `pardes.panes.Pane`, and its other `panes.X` references become `pardes.panes.X` because dump.zig's own tests use `panes` as a local name. The methods become free functions taking `p: *Pardes`: `p.dumpState()` becomes `dump.dumpState(p)`, `core.restore(bytes)` becomes `dump.restore(core, bytes)` and `Pardes.initFromDump(..)` becomes `dump.initFromDump(..)`, in pardes.zig, the shells, layout.zig, Terminal.zig, builtins.zig and the tests (38 receiver rewrites plus the initFromDump calls). The tag-tail restore helpers stay with the tag code. Co-Authored-By: Claude Opus 5.5 --- test/pdf.zig | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'test/pdf.zig') diff --git a/test/pdf.zig b/test/pdf.zig index dde58df8..8e87dfb1 100644 --- a/test/pdf.zig +++ b/test/pdf.zig @@ -301,7 +301,7 @@ test "PDF dump fallback remains a byte-preserving file" { defer out.deinit(); try std.zon.stringify.serialize(state, .{ .whitespace = true }, &out.writer); - const restored = try Pardes.initFromDump(gpa, .{ .tty_only = true }, out.written()); + const restored = try pardes.dump.initFromDump(gpa, .{ .tty_only = true }, out.written()); defer restored.deinit(); const pane = restored.panes[0].?; try std.testing.expect(pane.file != null); @@ -921,8 +921,8 @@ test "MuPDF pane renders, navigates, searches, and round-trips its page" { @memcpy(pane.tag_tail[0..custom_tail.len], custom_tail); pane.tag_tail_len = custom_tail.len; pane.tag_init = true; - try p.dumpState(); - const restored = try Pardes.initFromDump(gpa, .{}, p.dump_out.?); + try pardes.dump.dumpState(p); + const restored = try pardes.dump.initFromDump(gpa, .{}, p.dump_out.?); defer restored.deinit(); try std.testing.expect(hasPdf(restored.panes[0].?)); try std.testing.expectEqual(pane.pdf.?.page, restored.panes[0].?.pdf.?.page); -- cgit v1.3