diff options
Diffstat (limited to 'src/runtime_config.zig')
| -rw-r--r-- | src/runtime_config.zig | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/runtime_config.zig b/src/runtime_config.zig index 19964a48..bd1ba00b 100644 --- a/src/runtime_config.zig +++ b/src/runtime_config.zig @@ -5,6 +5,22 @@ const std = @import("std"); const panel_animation = @import("panel_animation.zig"); +/// HOW LONG A HOST-SUPPLIED ABSOLUTE PATH MAY BE, and the only reason this +/// record was ever kilobytes: the shell a native host resolved, the font file +/// a native picker returned, and (in pardes.zig) the one watched theme file. +/// All three name something on a FILESYSTEM, and all three are retained +/// inline because the core has no allocator at the point they arrive. +/// +/// Fixed at 4095 wherever a filesystem exists — deliberately NOT derived from +/// std.fs PATH_MAX, which web has no answer for, and 4095 rather than 4096 so +/// the macOS C bridge's NUL fits without a second, subtly different limit at +/// that boundary. Zero on the P4 firmware, which has no filesystem, no +/// processes to spawn a shell for and no font picker: `Text(0)` is a +/// zero-sized field whose `set` refuses every non-empty path, so the three +/// producers report failure instead of storing 12 KiB nothing can fill. +pub const host_path_cap: usize = + if (@import("pardes_config").platform == .p4) 0 else 4095; + /// Tagline glyphs retain body-cell geometry, so allowing a face larger than /// the body would clip into neighbouring cells. Zero would make the role /// invisible. Keep the runtime command on the same 1...100 contract as the @@ -47,18 +63,16 @@ pub const State = struct { /// pending until the next terminal spawn acknowledges it. shell: struct { requested: Text(255) = .{}, - // Fixed across native and freestanding builds: runtime State is one - // data schema, and web has no std.fs PATH_MAX to derive this from. - effective: Text(4095) = .{}, + // One data schema across native, browser and freestanding builds; only + // its one absolute-path field follows `host_path_cap`. + effective: Text(host_path_cap) = .{}, pending: bool = true, } = .{}, /// The shell acknowledges a font before `effective` changes. A rejected /// request therefore remains queryable without claiming it is on screen. font: struct { - // 4095 leaves room for the NUL in the macOS C bridge without a - // second, subtly different limit at that boundary. - requested_path: Text(4095) = .{}, + requested_path: Text(host_path_cap) = .{}, requested_name: Text(255) = .{}, effective_name: Text(255) = .{}, pending: bool = false, |
