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/output.zig | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'test/output.zig') diff --git a/test/output.zig b/test/output.zig index b4c018db..7c5f7f9b 100644 --- a/test/output.zig +++ b/test/output.zig @@ -438,9 +438,9 @@ test "Mini dump preserves its exact virtual snapshot and body writes detach colo const id = p.active; const before = p.panes[id].?.file.?; try std.testing.expect(before.mini != null); - try p.dumpState(); + try pardes.dump.dumpState(p); panes.File.setContent(p, &source.file.?, try p.gpa.dupe(u8, "changed\n")); - const restored = try Pardes.initFromDump(std.testing.allocator, .{ .tty_only = true }, p.dump_out.?); + const restored = try pardes.dump.initFromDump(std.testing.allocator, .{ .tty_only = true }, p.dump_out.?); defer restored.deinit(); const mini = restored.panes[restored.active].?; try std.testing.expectEqualStrings(before.content, mini.file.?.content); @@ -793,8 +793,8 @@ test "n/N skips formatted context and selects comment match locations" { try std.testing.expectEqualStrings(line[0..file.location_rows[row].location_end], selectedOutputText(result) orelse ""); try std.testing.expectEqual(available, p.freeSlot()); } - try p.dumpState(); - const restored = try Pardes.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?); + try pardes.dump.dumpState(p); + const restored = try pardes.dump.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?); defer restored.deinit(); pardes.look.armLookWalk(restored, id); const restored_result = restored.panes[id].?; @@ -1570,8 +1570,8 @@ test "stacked search and LSP results retain source tint navigation and dump owne const line = modal.lineSlice(file.content, matches[step.match]); try std.testing.expectEqualStrings(line[0..row.location_end], selectedOutputText(pane) orelse ""); } - try p.dumpState(); - const restored = try Pardes.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?); + try pardes.dump.dumpState(p); + const restored = try pardes.dump.initFromDump(p.gpa, .{ .tty_only = true }, p.dump_out.?); defer restored.deinit(); const restored_file = &restored.panes[id].?.file.?; try std.testing.expectEqualStrings(file.content, restored_file.content); -- cgit v1.3