summaryrefslogtreecommitdiff
path: root/src/dump.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-10-01 19:11:53 -0300
committerGabriel Schneider <[email protected]>2026-10-01 19:57:27 -0300
commit5f41a03fdcf0eaa3c1917e0f94243878c481cf8b (patch)
treec3025e2ca80a295962fa941bb4423df9a1525509 /src/dump.zig
parent6ee4c3caa6faf42b9825dca39e9130ac83f425a8 (diff)
downloadpardes-5f41a03fdcf0eaa3c1917e0f94243878c481cf8b.tar.gz
pardes-5f41a03fdcf0eaa3c1917e0f94243878c481cf8b.zip
Incl dir ... adds directories a look at a name found nowhere else is tried in, as acme's includename, <stdio.h> too; bare Incl lists them and Incl - empties them; the session's, seeded with /usr/include and /usr/local/include, kept in a dump; Indent's refusal says Enter keeps the indent always
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/dump.zig')
-rw-r--r--src/dump.zig11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/dump.zig b/src/dump.zig
index 005770e1..b64441d3 100644
--- a/src/dump.zig
+++ b/src/dump.zig
@@ -302,6 +302,8 @@ pub const State = struct {
/// config are kept on their own, and the font is the frontend's. Absent
/// in older dumps.
settings: []const []const u8 = &.{},
+ /// Incl's directories, in order; null in older dumps (the defaults).
+ incl: ?[]const []const u8 = null,
};
/// A header is a text like any other: it may hold newlines, but not a
@@ -798,6 +800,7 @@ pub fn dumpState(p: *Pardes) !void {
.panes = dump_panes[0..panes_len],
.mounts = mounts[0..p.fs.mounts.items.len],
.settings = try changedSettings(p, arena),
+ .incl = p.incl.items,
};
try validate(state);
var out: std.Io.Writer.Allocating = .init(p.gpa);
@@ -902,6 +905,14 @@ fn initDump(gpa: std.mem.Allocator, opts: Options, zon_bytes: []const u8, previo
p.locations_config = st.locations_config;
p.settings.tree_context_tag_style = st.tree_context_tag_style;
applySettings(p, st.settings);
+ if (st.incl) |dirs| {
+ for (p.incl.items) |dir| p.gpa.free(dir);
+ p.incl.clearRetainingCapacity();
+ for (dirs) |dir| if (dir.len > 0 and dir[0] == '/' and std.mem.indexOfScalar(u8, dir, 0) == null) {
+ const copy = p.gpa.dupe(u8, dir) catch continue;
+ p.incl.append(p.gpa, copy) catch p.gpa.free(copy);
+ };
+ }
// A dump naming a ThemeFile asks the host to load it again: until it
// has, and for good if it fails, the theme this session showed goes on
// (a failed ThemeFile changes nothing, a Restore's included), unless