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 --- src/layout.zig | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/layout.zig') diff --git a/src/layout.zig b/src/layout.zig index 116a64b8..3d8932a8 100644 --- a/src/layout.zig +++ b/src/layout.zig @@ -1,5 +1,6 @@ const std = @import("std"); const pardes = @import("pardes.zig"); +const dump = @import("dump.zig"); const config = @import("config.zig"); const panes = @import("panes.zig"); const Pardes = pardes.Pardes; @@ -1442,8 +1443,8 @@ test "collapse dump restores folded state and retained expansion weight" { compute(p); const original_height = p.rects[0].h; toggleCollapse(p, 0); - try p.dumpState(); - const restored = try Pardes.initFromDump(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 32 }, p.dump_out.?); + try dump.dumpState(p); + const restored = try dump.initFromDump(std.testing.allocator, .{ .tty_only = true, .cols = 80, .rows = 32 }, p.dump_out.?); defer restored.deinit(); try std.testing.expect(restored.panes[0].?.collapsed); try std.testing.expectEqual(@as(f32, @floatFromInt(original_height)), restored.panes[0].?.vweight); -- cgit v1.3