diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-30 19:54:01 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:17 -0300 |
| commit | 63983ab4b235fb2b6617e8d055e644e0e986d8fd (patch) | |
| tree | a85df139318fa81500e9d1dd38a0b802f0a2f0db /src/config.zig | |
| parent | 872294ece905b8b5336e01ec3ce3f5420cd35b50 (diff) | |
| download | pardes-63983ab4b235fb2b6617e8d055e644e0e986d8fd.tar.gz pardes-63983ab4b235fb2b6617e8d055e644e0e986d8fd.zip | |
Every setting's bad-value refusal names what it takes: InactiveDim 0-100, MessageLinger 0-60000 milliseconds, a path's limit, a font's form
A setting that chooses among words named them, but one that takes a
number, a path or a font said only "bad value" over 9P and "does not
take that value" from a tag, leaving the range to be guessed. The
refusal, both ways, now says its range or what it takes, from one
table beside the words.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/config.zig')
| -rw-r--r-- | src/config.zig | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/config.zig b/src/config.zig index a7377cfa..a17e2fd2 100644 --- a/src/config.zig +++ b/src/config.zig @@ -1242,6 +1242,22 @@ pub const Runtime = struct { }; } + /// What a setting takes, for a refusal of a bad value to name: its + /// words (`choices`), else its range or the kind of thing it takes. + pub fn takes(action: Action) ?[]const u8 { + return choices(action) orelse switch (action) { + .inactive_dim, .window_opacity, .window_blur => "0-100 (a percentage)", + .grip_width => "50-300 (a percentage)", + .tagline_size => std.fmt.comptimePrint("{d}-{d} (a percentage)", .{ tagline_percent_min, tagline_percent_max }), + .message_ms => std.fmt.comptimePrint("0-{d} (milliseconds)", .{message_ms_max}), + .shell => "a path of at most 255 bytes; bare, the login shell", + .dump_dir => std.fmt.comptimePrint("a path of at most {d} bytes; bare, the default", .{limits.host_path_cap}), + .shader => "a Shadertoy file's path, or off", + .font => "a name or path, :8 to :72 after it (Mono:14)", + else => null, + }; + } + /// The value a choice word names, or bare, the one after `now`; null for /// a word it does not take. fn stepped(comptime T: type, now: T, argument: ?[]const u8) ?T { |
