diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-29 19:09:26 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-29 21:13:33 -0300 |
| commit | 2eb8860b2ca05c426f3962661441aaee13d3be44 (patch) | |
| tree | 8d363280576cc86db7209ef37c6210a0d5b75c8e /src/dump.zig | |
| parent | e4cfd57bc41c5740e3a823a8f05d70d3e87b68ca (diff) | |
| download | pardes-2eb8860b2ca05c426f3962661441aaee13d3be44.tar.gz pardes-2eb8860b2ca05c426f3962661441aaee13d3be44.zip | |
web: the browser shell builds again and loads a dump of a native build: a theme by its name, a field compiled out passed over, no disk asked; touch.dump replaces the hand-written ZON fixture
Fixed for wasm32-freestanding: counts as usize, no threads, stb_image, tape or
host stat there. touch.mjs follows the renderer's 13 tag-layer fields, helix's
retuned colours and the tag column.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/dump.zig')
| -rw-r--r-- | src/dump.zig | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/dump.zig b/src/dump.zig index abc52f5a..c33ac02c 100644 --- a/src/dump.zig +++ b/src/dump.zig @@ -142,11 +142,13 @@ pub fn defaultDirectory(buf: []u8) ?[]const u8 { /// A session's dump: its core, everything it is but what is the host's, /// the frame's or worked out again (`replica` in each type, src/walk.zig), -/// then its 9P mounts, which live with the 9P server's own state, and which -/// of its panes' files were on disk when it was made (one gone by its load -/// is said deleted: its text is nowhere else now). -const Session = walk.Dump(&.{ Pardes, []const filesystem.Mount, OnDisk }); -const SessionLoad = walk.Load(&.{ Pardes, []const filesystem.Mount, OnDisk }); +/// then its 9P mounts, which live with the 9P server's own state, which of +/// its panes' files were on disk when it was made (one gone by its load is +/// said deleted: its text is nowhere else now), and its theme's name: the +/// setting is a place in this build's ring of themes, another build's +/// ring is another. +const Session = walk.Dump(&.{ Pardes, []const filesystem.Mount, OnDisk, []const u8 }); +const SessionLoad = walk.Load(&.{ Pardes, []const filesystem.Mount, OnDisk, []const u8 }); const OnDisk = [MAX_PANES]bool; fn onDisk(pane: *const pardes.panes.Pane) bool { @@ -176,6 +178,8 @@ pub fn dumpBytes(p: *Pardes) ![]u8 { on.* = onDisk(pane); }; try d.put(OnDisk, &on_disk); + const theme: []const u8 = colors.themes[@min(p.settings.theme, colors.themes.len - 1)].name; + try d.put([]const u8, &theme); return d.finish(); } @@ -233,6 +237,12 @@ fn loadKnowing(gpa: std.mem.Allocator, opts: Options, bytes: []const u8, notes: } const was = try l.get(OnDisk); if (on_disk) |out| out.* = was; + const theme = try l.get([]const u8); + defer gpa.free(theme); + // This build's place for that theme; one it has not, its first. + p.settings.theme = for (colors.themes, 0..) |t, i| { + if (std.mem.eql(u8, t.name, theme)) break i; + } else if (p.settings.theme < colors.themes.len) p.settings.theme else 0; // A mount this process was started with stands; one of the same name // to elsewhere is refused, never silently put over it. for (mounts) |m| { @@ -411,7 +421,8 @@ fn revivePane(p: *Pardes, id: usize, pane: *pardes.panes.Pane, was_on_disk: bool // Its file gone from disk since the dump: its text is nowhere else, so // it is said deleted, and Del, Exit and Restore ask first. One never on // disk (a name not yet saved) comes back as it was. - if (was_on_disk and !onDisk(pane)) pardes.panes.File.deleted(p, @intCast(id)); + // (A host with no disk of its own, the web's, asks nothing.) + if (comptime pardes.hosted) if (was_on_disk and !onDisk(pane)) pardes.panes.File.deleted(p, @intCast(id)); } // ---- one pane to and from a dump: the store's, a handover's ---- |
