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 /src/tty | |
| 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 'src/tty')
| -rw-r--r-- | src/tty/tty.zig | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/tty/tty.zig b/src/tty/tty.zig index 89a476f2..fe968650 100644 --- a/src/tty/tty.zig +++ b/src/tty/tty.zig @@ -5,6 +5,7 @@ const posix = std.posix; const libc = std.c; const vaxis = @import("vaxis"); const pardes = @import("../pardes.zig"); +const dump = @import("../dump.zig"); const tracy = @import("../tracy.zig"); const look = @import("../look.zig"); const message = pardes.Messages.Message; @@ -700,7 +701,7 @@ fn localSession( var core = if (options.load_path) |lp| blk: { const bytes = try filesystem.readFile(gpa, lp); defer gpa.free(bytes); - break :blk try pardes.Pardes.initFromDump(allocs.pardes, options, bytes); + break :blk try pardes.dump.initFromDump(allocs.pardes, options, bytes); } else try pardes.Pardes.init(allocs.pardes, options); defer core.deinit(); @@ -802,7 +803,7 @@ fn localSession( break :blk; }; defer gpa.free(bytes); - const nc = core.restore(bytes) catch |err| { + const nc = dump.restore(core, bytes) catch |err| { core.reportError(core.active, "Restore", err); break :blk; }; |
