diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-27 22:34:56 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:14 -0300 |
| commit | 7ba54de4bd498c2a56ea3d0d43c88356759f7b1f (patch) | |
| tree | 2e661d1785ef6e74c158ca6b2e1aa96b763ec7bc /test/panes.zig | |
| parent | 52049344c1992850ea712e029eb5c4a88a7dfe19 (diff) | |
| download | pardes-7ba54de4bd498c2a56ea3d0d43c88356759f7b1f.tar.gz pardes-7ba54de4bd498c2a56ea3d0d43c88356759f7b1f.zip | |
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 <[email protected]>
Diffstat (limited to 'test/panes.zig')
| -rw-r--r-- | test/panes.zig | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/test/panes.zig b/test/panes.zig index f99f9d56..1c861070 100644 --- a/test/panes.zig +++ b/test/panes.zig @@ -2039,7 +2039,7 @@ test "file history survives PDF fallback restoration and allocation failures" { var succeeded = false; for (0..256) |failure| { var failing = std.testing.FailingAllocator.init(std.testing.allocator, .{ .fail_index = failure }); - if (Pardes.initFromDump(failing.allocator(), .{ .tty_only = true }, saved)) |p| { + if (pardes.dump.initFromDump(failing.allocator(), .{ .tty_only = true }, saved)) |p| { defer p.deinit(); const pane = p.panes[0].?; try std.testing.expect(pane.file != null); @@ -2416,8 +2416,8 @@ const OutputTests = struct { neighbor_colored = neighbor_colored or style != 0; try std.testing.expect(neighbor_colored); - 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_source = restored.panes[0].?; const restored_id = pane.search_pane.?; @@ -2520,8 +2520,8 @@ const OutputTests = struct { try std.testing.expectEqual(.match, file.location_rows[next].kind); const wrapped = panes.Output.nextResult(file.content, file.location_rows, path, .{ .line = 99 }); try std.testing.expectEqual(@as(usize, 2), file.location_rows[wrapped].at.line); - 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[pane.search_pane.?].?.file.?; try std.testing.expectEqualStrings(file.content, restored_file.content); |
