summaryrefslogtreecommitdiff
path: root/src/dump.zig
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-11 12:38:56 -0300
committerGabriel Schneider <[email protected]>2026-09-15 17:24:42 -0300
commit682e237df7e8b22f820d14a4adee58e6e2f84268 (patch)
tree5d888cb46f1a49e89fc55e2a4c232d3af0265b1d /src/dump.zig
parent6878e1c309172d624c0d7a3555f6f0217ae6770e (diff)
downloadpardes-682e237df7e8b22f820d14a4adee58e6e2f84268.tar.gz
pardes-682e237df7e8b22f820d14a4adee58e6e2f84268.zip
trunk: resume before the Reload experiment
Empty marker on the last pre-Reload change. Keep the Reload experiment on reload (3801914), its first change on reload-start (200a1fc), and the unfinished performance investigation on reload-perf-wip.
Diffstat (limited to 'src/dump.zig')
-rw-r--r--src/dump.zig9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/dump.zig b/src/dump.zig
index 93bf08cc..ff46205f 100644
--- a/src/dump.zig
+++ b/src/dump.zig
@@ -109,6 +109,7 @@ pub const Pane = struct {
cols: u16 = 0,
rows: u16 = 0,
vweight: f32 = 1,
+ collapsed: bool = false,
/// Exact editable tail when the user touched it. Null retains the live
/// default; a present empty slice deliberately restores an empty tail.
tag_tail: ?[]const u8 = null,
@@ -118,6 +119,7 @@ pub const Pane = struct {
};
pub const Column = struct {
+ tag: ?[]const u8 = null,
weight: f32 = 1,
panes: []const usize = &.{},
};
@@ -130,13 +132,20 @@ pub const State = struct {
screen: Size,
active: usize = 0,
topbar: []const u8 = "",
+ topbar_custom: ?[]const u8 = null,
theme: []const u8 = "dark",
columns: []const Column = &.{},
panes: []const Pane = &.{},
mounts: []const Mount = &.{},
};
+fn validateTag(bar: []const u8) !void {
+ if (bar.len > limits.max_tag_tail or std.mem.indexOfAny(u8, bar, "\r\n\x00") != null or !std.unicode.utf8ValidateSlice(bar)) return error.BadDumpTag;
+}
+
pub fn validate(state: State) !void {
+ if (state.topbar_custom) |bar| try validateTag(bar);
+ for (state.columns) |column| if (column.tag) |bar| try validateTag(bar);
if (!std.mem.eql(u8, state.magic, magic)) return error.BadDumpMagic;
if (state.version != version) return error.BadDumpVersion;
if (state.panes.len == 0 or state.panes.len > max_panes) return error.BadDumpPanes;