summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-11-19 20:34:29 -0300
committerGabriel Schneider <[email protected]>2026-11-19 21:02:38 -0300
commit0d5c7d937c7d592ac7f3a9a8253993bffa283288 (patch)
tree987c668d92cb3b0a954e5aab32c180df924c2d0c
parent0db34fbf28e70c8c6a3c6025c0888fc5ec75201c (diff)
downloadpardes-0d5c7d937c7d592ac7f3a9a8253993bffa283288.tar.gz
pardes-0d5c7d937c7d592ac7f3a9a8253993bffa283288.zip
core, dev, runtime, test: the settings a session changes while it runs are `config.Settings`, no longer `config.Runtime` (P18, the user's ruling on the tree step's name collisions: the type's name collided with the directory `runtime/`, and the core's field of that type is already `settings`): the type on 17 lines of core/config.zig (its declaration, its methods' receivers, its tests, the comment naming it), `config.Settings` on 50 lines of eleven other files (core/Core.zig, Output.zig, builtins.zig, builtins_json.zig, exec.zig, ninep/ctl.zig, surface.zig; dev/gui/gui.zig 598, 5860, 5909; dev/jump_trail.zig's comment; runtime/main.zig 756; test/output.zig 552) and docs/next-winmode.md's one mention; a rename only, nothing else on any line; the semantics hash does not move (a type's name is not in the tape's shape); tui core-test 848/991 (143 skipped), shell-test 1027/1030, gui unit-test 1625/1629 failing only the perf check's BaselineHarnessMismatch (as the base), the macOS library for Linux and aarch64-macos and the FreeBSD cross-build rc 0, under a load of 6 to 42
Co-Authored-By: Claude Opus <[email protected]> Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
-rw-r--r--core/Core.zig12
-rw-r--r--core/Output.zig8
-rw-r--r--core/builtins.zig20
-rw-r--r--core/builtins_json.zig4
-rw-r--r--core/config.zig34
-rw-r--r--core/exec.zig16
-rw-r--r--core/ninep/ctl.zig26
-rw-r--r--core/surface.zig2
-rw-r--r--dev/gui/gui.zig6
-rw-r--r--dev/jump_trail.zig2
-rw-r--r--docs/next-winmode.md2
-rw-r--r--runtime/main.zig2
-rw-r--r--test/output.zig2
13 files changed, 68 insertions, 68 deletions
diff --git a/core/Core.zig b/core/Core.zig
index d5a990e2..e9f4f0e4 100644
--- a/core/Core.zig
+++ b/core/Core.zig
@@ -288,7 +288,7 @@ session_home: [limits.host_path_cap]u8 = undefined,
session_home_len: ?u16 = null,
session_shell: [limits.host_path_cap]u8 = undefined,
session_shell_len: u16 = 0,
-settings: config.Runtime = .{ .font = .{ .tagline_percent = config.gui_tagline_font_percent } },
+settings: config.Settings = .{ .font = .{ .tagline_percent = config.gui_tagline_font_percent } },
locations_config: locations.Config = .{},
locations_cache: locations.Cache = .{},
tty_filter_palette: pardes.Term.FilterPalette = .{},
@@ -296,10 +296,10 @@ font_request_taken: bool = false,
custom_theme: ?Theme = null,
/// bodyChrome's: the theme it was worked out for, and it.
body_chrome: ?struct { theme: Theme, chrome: ChromeTheme } = null,
-theme_file_path: config.Runtime.Text(limits.host_path_cap) = .{},
+theme_file_path: config.Settings.Text(limits.host_path_cap) = .{},
/// The ThemeFile last loaded whole: what /ctl and DumpConfig name, and
/// what a failed ThemeFile goes back to (colors.revertThemeFile).
-theme_file_loaded: config.Runtime.Text(limits.host_path_cap) = .{},
+theme_file_loaded: config.Settings.Text(limits.host_path_cap) = .{},
theme_file_generation: u32 = 0,
theme_file_pane: u8 = 0,
chrome: colors.ChromeTheme = colors.initial_chrome,
@@ -1102,7 +1102,7 @@ fn observeFontInner(
p: *Pardes,
effective_name: []const u8,
effective_size_hundredths: u16,
- unit: config.Runtime.FontSizeUnit,
+ unit: config.Settings.FontSizeUnit,
) bool {
if (!p.settings.font.effective_name.set(effective_name)) return false;
p.settings.font.effective_size_hundredths = effective_size_hundredths;
@@ -1117,7 +1117,7 @@ fn acknowledgeFontInner(
p: *Pardes,
effective_name: []const u8,
effective_size_hundredths: u16,
- unit: config.Runtime.FontSizeUnit,
+ unit: config.Settings.FontSizeUnit,
) bool {
if (!p.settings.font.pending or !p.font_request_taken) return false;
const changed = !std.mem.eql(
@@ -3423,7 +3423,7 @@ test "Font keeps requested and acknowledged faces as separate plain state" {
try std.testing.expect(!p.settings.font.pending);
try std.testing.expectEqualStrings(installed[0].name, p.settings.font.effective_name.get());
try std.testing.expectEqual(@as(u16, 1375), p.settings.font.effective_size_hundredths);
- try std.testing.expectEqual(config.Runtime.FontSizeUnit.pixels, p.settings.font.effective_size_unit);
+ try std.testing.expectEqual(config.Settings.FontSizeUnit.pixels, p.settings.font.effective_size_unit);
try std.testing.expect(!p.acknowledgeFont("Duplicate Ack", 1400, .pixels));
try std.testing.expect(p.executeBuiltinLine(p.view().active, cmd));
diff --git a/core/Output.zig b/core/Output.zig
index 3ac9f521..ab84ae35 100644
--- a/core/Output.zig
+++ b/core/Output.zig
@@ -705,7 +705,7 @@ pub fn openThemes(p: *Pardes, id: usize) !void {
for (pardes.themes, 0..) |t, i| {
if (pardes.colors.groupAt(i)) |title|
try out.writer.print("{s}# {s}\n", .{ if (i == 0) "" else "\n", title });
- try out.writer.print(comptime config.Runtime.findAction(.theme).?.word ++ " {s}\n", .{t.name});
+ try out.writer.print(comptime config.Settings.findAction(.theme).?.word ++ " {s}\n", .{t.name});
}
const content = try out.toOwnedSlice();
try openStepped(p, id, .{ .cmd = .Themes }, content);
@@ -716,7 +716,7 @@ pub fn isWalkRow(file: *const File.State, row: usize, line: []const u8) bool {
if (usesLocationsConfig(state.from) or std.meta.eql(state.from, Origin{ .query = .callstack })) return isResultRow(file, row);
if (!std.meta.eql(state.from, Origin{ .cmd = .Themes })) return true;
// Section labels are for reading, not stops in the command walk.
- return std.mem.startsWith(u8, std.mem.trimStart(u8, line, " \t"), comptime config.Runtime.findAction(.theme).?.word ++ " ");
+ return std.mem.startsWith(u8, std.mem.trimStart(u8, line, " \t"), comptime config.Settings.findAction(.theme).?.word ++ " ");
}
pub fn openFonts(p: *Pardes, id: usize) !void {
@@ -733,7 +733,7 @@ fn fontsListed(gpa: std.mem.Allocator, arena: std.mem.Allocator) anyerror![]u8 {
var out: std.Io.Writer.Allocating = .init(gpa);
errdefer out.deinit();
for (fonts.list(arena, null)) |f|
- try out.writer.print(comptime config.Runtime.findAction(.font).?.word ++ " {s}\n", .{f.name});
+ try out.writer.print(comptime config.Settings.findAction(.font).?.word ++ " {s}\n", .{f.name});
return out.toOwnedSlice();
}
@@ -852,7 +852,7 @@ pub fn openConfig(p: *Pardes, id: usize) !void {
var located: std.Io.Writer.Allocating = .init(p.gpa);
defer located.deinit();
try p.locations_config.write(&located.writer);
- try config.Runtime.writeReport(&out.writer, .{
+ try config.Settings.writeReport(&out.writer, .{
.locations = located.written(),
.default_dump_dir = p.tape.authority(dumpDirectory, .{@as([]u8, &dir_buf)}),
.startup_config_path = p.startupPath(),
diff --git a/core/builtins.zig b/core/builtins.zig
index 6f37e86d..1e0692a5 100644
--- a/core/builtins.zig
+++ b/core/builtins.zig
@@ -18,7 +18,7 @@ const keys = @import("keys.zig");
const Jump = @import("Jump.zig");
/// What this build's own frontend draws and its host does: the render's.
-pub const frontend: config.Runtime.Capabilities = .{
+pub const frontend: config.Settings.Capabilities = .{
.font_picker = pardes.font_picker,
// The tty's font belongs to its emulator.
.tagline_font_size = pardes.platform != .tui,
@@ -32,15 +32,15 @@ pub const frontend: config.Runtime.Capabilities = .{
/// its own frontend does (`viewCapabilities`), so a terminal's replica of a
/// window's session steps as the window's own does, and back.
pub const desktop = pardes.platform == .tui or pardes.platform == .gui;
-const window_capabilities: config.Runtime.Capabilities = .{ .font_picker = true, .tagline_font_size = true, .window_opacity = true, .pixels = true };
-const terminal_capabilities: config.Runtime.Capabilities = .{ .font_picker = false, .tagline_font_size = false, .window_opacity = false, .pixels = false };
+const window_capabilities: config.Settings.Capabilities = .{ .font_picker = true, .tagline_font_size = true, .window_opacity = true, .pixels = true };
+const terminal_capabilities: config.Settings.Capabilities = .{ .font_picker = false, .tagline_font_size = false, .window_opacity = false, .pixels = false };
/// The words this build has: a desktop build's are the window's.
-pub const capabilities: config.Runtime.Capabilities = if (desktop) window_capabilities else frontend;
+pub const capabilities: config.Settings.Capabilities = if (desktop) window_capabilities else frontend;
/// What the live view's frontend takes: a window's, or a terminal's
/// (`Pardes.frontend`, which its client says, Event.frontend).
-pub fn viewCapabilities(p: *const Pardes) config.Runtime.Capabilities {
+pub fn viewCapabilities(p: *const Pardes) config.Settings.Capabilities {
if (comptime !desktop) return frontend;
return if (p.view().frontend.windowed) window_capabilities else terminal_capabilities;
}
@@ -136,10 +136,10 @@ fn manualBuiltinList() []const type {
}
}
-fn settingList() []const config.Runtime.Setting {
+fn settingList() []const config.Settings.Setting {
comptime {
- var list: []const config.Runtime.Setting = &.{};
- for (config.Runtime.settings) |setting| if (setting.enabled(capabilities)) {
+ var list: []const config.Settings.Setting = &.{};
+ for (config.Settings.settings) |setting| if (setting.enabled(capabilities)) {
list = list ++ .{setting};
};
return list;
@@ -175,7 +175,7 @@ pub const registry = struct {
}
/// `here` for a frontend of these capabilities, windowed or not.
- pub fn hereFor(b: Builtin(), caps: config.Runtime.Capabilities, windowed: bool) bool {
+ pub fn hereFor(b: Builtin(), caps: config.Settings.Capabilities, windowed: bool) bool {
inline for (comptime manualBuiltinList(), 0..) |T, i| if (@backingInt(b) == i) return !@hasDecl(T, "in_window") or windowed;
inline for (comptime settingList(), comptime manualBuiltinList().len..) |setting, i| if (@backingInt(b) == i) return setting.enabled(caps);
unreachable;
@@ -1873,7 +1873,7 @@ fn testDump(buf: []u8) ![]const u8 {
test "capabilities exactly gate setting builtins" {
const Builtin = registry.Builtin();
- for (config.Runtime.settings) |setting| {
+ for (config.Settings.settings) |setting| {
const registered = std.meta.stringToEnum(Builtin, setting.word) != null;
try std.testing.expectEqual(setting.enabled(capabilities), registered);
}
diff --git a/core/builtins_json.zig b/core/builtins_json.zig
index 3773e5ae..23e15098 100644
--- a/core/builtins_json.zig
+++ b/core/builtins_json.zig
@@ -65,11 +65,11 @@ pub fn write(w: *std.Io.Writer, addon_sources: []const []const u8) std.Io.Writer
try w.writeAll(if (builtins.registry.takesArg(b)) "true" else "false");
try w.writeAll(", \"scope\": ");
try str(if (b == .Edit) "both" else if (builtins.registry.scope(b) == .session) "root" else "pane", .{}, w);
- const setting = config.Runtime.find(name);
+ const setting = config.Settings.find(name);
try w.writeAll(", \"setting\": ");
try w.writeAll(if (setting != null) "true" else "false");
try w.writeAll(", \"choices\": ");
- if (setting) |s| if (config.Runtime.choices(s.action)) |v| try str(v, .{}, w) else try w.writeAll("null") else try w.writeAll("null");
+ if (setting) |s| if (config.Settings.choices(s.action)) |v| try str(v, .{}, w) else try w.writeAll("null") else try w.writeAll("null");
var buf: [2048]u8 = undefined;
const doc = if (setting) |s| s.doc else ctl.summaryOf(name, &buf);
try w.writeAll(", \"doc\": ");
diff --git a/core/config.zig b/core/config.zig
index 792a7e62..e8b740d5 100644
--- a/core/config.zig
+++ b/core/config.zig
@@ -600,7 +600,7 @@ pub const delete_word_forward: []const Chord = &.{ .{ .cp = 'd', .alt = true },
pub const kill_to_line_start: []const Chord = &.{.{ .cp = 'u', .ctrl = true }};
pub const kill_to_line_end: []const Chord = &.{.{ .cp = 'k', .ctrl = true }};
-pub const Runtime = struct {
+pub const Settings = struct {
theme: usize = 0,
wrap: bool = true,
debug: bool = false,
@@ -662,7 +662,7 @@ pub const Runtime = struct {
tab: u16 = tab_width,
callstack_depth: u8 = @import("lsp/lsp.zig").callstack_default_depth,
- /// A setting that is one of a few words, each an enum field of Runtime.
+ /// A setting that is one of a few words, each an enum field of Settings.
pub const Choice = enum { pet };
pub const Pet = enum { off, cat, frog };
@@ -710,7 +710,7 @@ pub const Runtime = struct {
};
// Validate the complete request before changing any member.
- pub fn requestFont(state: *Runtime, path: []const u8, name: []const u8, size_hundredths: u16) bool {
+ pub fn requestFont(state: *Settings, path: []const u8, name: []const u8, size_hundredths: u16) bool {
if (path.len > state.font.requested_path.bytes.len or
name.len > state.font.requested_name.bytes.len) return false;
if (size_hundredths != 0 and (size_hundredths < 800 or size_hundredths > 7200)) return false;
@@ -834,7 +834,7 @@ pub const Runtime = struct {
}
/// `home`: what `~` is (the session's: Pardes.session_home).
- pub fn apply(state: *Runtime, tape: *pardes.tape.Tape, setting: Setting, argument: ?[]const u8, home: ?[]const u8) bool {
+ pub fn apply(state: *Settings, tape: *pardes.tape.Tape, setting: Setting, argument: ?[]const u8, home: ?[]const u8) bool {
switch (setting.action) {
// Every toggle names a bool field of its own, so one line covers
// all of them and a new toggle needs no arm here. Bare, a toggle
@@ -903,7 +903,7 @@ pub const Runtime = struct {
return switch (action) {
.toggle => "on, off",
.choice => |which| switch (which) {
- inline else => |field| comptime words.of(@FieldType(Runtime, @tagName(field))),
+ inline else => |field| comptime words.of(@FieldType(Settings, @tagName(field))),
},
else => null,
};
@@ -970,7 +970,7 @@ pub const Runtime = struct {
default_dump_dir: []const u8 = "",
native_images: bool = false,
capabilities: Capabilities,
- state: *const Runtime,
+ state: *const Settings,
/// The `LocationsConfig` argument in effect, as it would be typed.
locations: []const u8 = "",
};
@@ -1068,7 +1068,7 @@ pub const Runtime = struct {
}
test "a toggle flips when bare and sets when told on or off" {
- var state: Runtime = .{};
+ var state: Settings = .{};
const verbose = find("Verbose").?;
try std.testing.expect(state.verbose);
// Bare, it flips: that is what a tagline word does.
@@ -1090,7 +1090,7 @@ pub const Runtime = struct {
}
test "simple setting application mutates only its plain field" {
- var state: Runtime = .{};
+ var state: Settings = .{};
try std.testing.expect(apply(&state, &pardes.tape.none, find("Wrap").?, null, null));
try std.testing.expect(!state.wrap);
try std.testing.expect(apply(&state, &pardes.tape.none, find("Shell").?, " fish\n", null));
@@ -1100,7 +1100,7 @@ pub const Runtime = struct {
test "tagline size validates before mutating live state" {
const setting = find("TaglineSize").?;
- var state: Runtime = .{};
+ var state: Settings = .{};
for ([_][]const u8{ "1", " 82\n", "100" }) |argument| {
try std.testing.expect(apply(&state, &pardes.tape.none, setting, argument, null));
@@ -1116,7 +1116,7 @@ pub const Runtime = struct {
test "window opacity defaults to opaque validates atomically and retries" {
const setting = find("WindowOpacity").?;
- var state: Runtime = .{};
+ var state: Settings = .{};
try std.testing.expectEqual(@as(u8, 100), state.window_opacity);
try std.testing.expect(state.window_opacity_pending);
try std.testing.expectEqual(Capability.window_opacity, availability(setting.action).?);
@@ -1141,7 +1141,7 @@ pub const Runtime = struct {
}
test "font request tuple rejects atomically" {
- var state: Runtime = .{};
+ var state: Settings = .{};
try std.testing.expect(requestFont(&state, "/fonts/old.ttf", "Old", 1200));
var too_long: [256]u8 = @splat('x');
try std.testing.expect(!requestFont(&state, "/fonts/new.ttf", &too_long, 1800));
@@ -1168,7 +1168,7 @@ pub const Runtime = struct {
// The switches, Theme, Shell, Pager and the shell's own lines are
// test/behaviour/settings.zig's, read through the root ctl and the
// +DumpConfig pane.
- var state: Runtime = .{};
+ var state: Settings = .{};
// Every setting, every context line: the report outgrows 4K.
var storage: [8192]u8 = undefined;
const context: ReportContext = .{
@@ -1219,7 +1219,7 @@ pub const Runtime = struct {
"# Native images: on\n",
}) |expected| try std.testing.expect(std.mem.indexOf(u8, report, expected) != null);
- var defaults: Runtime = .{};
+ var defaults: Settings = .{};
var defaults_context = context;
defaults_context.startup_config_path = null;
defaults_context.platform = "tui";
@@ -1693,7 +1693,7 @@ test "wheel drift guard" {
}
test {
- _ = Runtime;
+ _ = Settings;
_ = User;
}
@@ -1838,14 +1838,14 @@ test "reference.typ's #fstree is the tree the session serves, file for file" {
}
test "CallstackDepth is bounded and keeps the last valid runtime limit" {
- var state: Runtime = .{};
+ var state: Settings = .{};
try std.testing.expectEqual(@as(u8, 8), state.callstack_depth);
for ([_][]const u8{ "1", "8", "16", "64" }) |value| {
- try std.testing.expect(Runtime.apply(&state, &pardes.tape.none, Runtime.find("CallstackDepth").?, value, null));
+ try std.testing.expect(Settings.apply(&state, &pardes.tape.none, Settings.find("CallstackDepth").?, value, null));
try std.testing.expectEqual(try std.fmt.parseInt(u8, value, 10), state.callstack_depth);
}
for ([_][]const u8{ "0", "65", "256", "-1", "+8", "1_6", "eight", "" }) |value| {
- try std.testing.expect(!Runtime.apply(&state, &pardes.tape.none, Runtime.find("CallstackDepth").?, value, null));
+ try std.testing.expect(!Settings.apply(&state, &pardes.tape.none, Settings.find("CallstackDepth").?, value, null));
try std.testing.expectEqual(@as(u8, 64), state.callstack_depth);
}
}
diff --git a/core/exec.zig b/core/exec.zig
index 687faa98..1ec47eb3 100644
--- a/core/exec.zig
+++ b/core/exec.zig
@@ -288,7 +288,7 @@ pub fn withArg(p: *Pardes, txt: []const u8, arg: ?[]const u8) []const u8 {
// A switch (Verbose, Wrap) clicked with some other text
// selected flips, as it does bare: only `on` or `off` is an argument
// for it. What a ctl write gives it is checked strictly instead.
- if (config.Runtime.find(commandText(t))) |setting| switch (setting.action) {
+ if (config.Settings.find(commandText(t))) |setting| switch (setting.action) {
.toggle => if (!std.mem.eql(u8, a, "on") and !std.mem.eql(u8, a, "off")) return txt,
else => {},
};
@@ -688,7 +688,7 @@ pub fn executeFrom(p: *Pardes, id: usize, txt: []const u8, from_body: bool) ?usi
// A builtin or setting this build lacks (Fonts on a terminal) is said,
// never run as a shell command.
const word = cmd[0 .. std.mem.indexOfAny(u8, cmd, " \t") orelse cmd.len];
- if (builtins.absentWhy(word) orelse if (config.Runtime.find(word) != null) @as([]const u8, "GUI-only") else null) |why| {
+ if (builtins.absentWhy(word) orelse if (config.Settings.find(word) != null) @as([]const u8, "GUI-only") else null) |why| {
var said: pardes.Kind.Buf(96) = .{};
p.reportFailure(id, said.print("{s} is {s}, invalid here", .{ word, why }));
return null;
@@ -937,7 +937,7 @@ fn applyInitText(p: *Pardes, text: []const u8, settings_only: bool) void {
// `#` starts a comment only at a line's start: a value may hold one
// (`#ff0000`).
if (word.len == 0 or isComment(word)) continue;
- const setting = config.Runtime.find(word[0 .. std.mem.indexOfAny(u8, word, " \t") orelse word.len]);
+ const setting = config.Settings.find(word[0 .. std.mem.indexOfAny(u8, word, " \t") orelse word.len]);
// Saved in a pane, its settings run again and its commands do not:
// a word that is neither (a typo) is still said, as at startup.
if (settings_only and setting == null and std.meta.stringToEnum(Builtin, word[0 .. std.mem.indexOfAny(u8, word, " \t+") orelse word.len]) != null) continue;
@@ -996,7 +996,7 @@ pub fn runBuiltinFrom(p: *Pardes, b: Builtin, id: usize, txt: []const u8, arg: ?
builtins.registry.dispatch(b, c);
}
-pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[]const u8) void {
+pub fn applySettingBuiltin(p: *Pardes, setting: config.Settings.Setting, arg: ?[]const u8) void {
const v = p.view();
const previous_tagline_percent = p.settings.font.tagline_percent;
switch (setting.action) {
@@ -1015,7 +1015,7 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[]
},
.font => {
if (comptime !font_picker) return;
- const spec = config.Runtime.FontSpec.parse(arg orelse return) orelse return;
+ const spec = config.Settings.FontSpec.parse(arg orelse return) orelse return;
// The session's machine's fonts, a question to its disk: a
// client's replay takes the session's answer, never its own.
const found = pardes.tape.site(.fonts, p.scratch.allocator(), fontNamed, .{ p.scratch.allocator(), spec.name });
@@ -1039,7 +1039,7 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[]
var text: pardes.Kind.Buf(340) = .{};
return p.reportFailure(v.active, text.print("Shell: {s}", .{refused}));
}
- if (!p.settings.apply(p.tape, setting, want, p.sessionHome())) p.reportFailure(v.active, "Shell: takes " ++ comptime config.Runtime.takes(.shell).?);
+ if (!p.settings.apply(p.tape, setting, want, p.sessionHome())) p.reportFailure(v.active, "Shell: takes " ++ comptime config.Settings.takes(.shell).?);
},
// Bare, each says its value, as acme's Tab says the width.
inline .tab, .callstack_depth => |_, tag| if (arg == null) {
@@ -1047,14 +1047,14 @@ pub fn applySettingBuiltin(p: *Pardes, setting: config.Runtime.Setting, arg: ?[]
return p.setMessage(.at(v.active), said.print("{s} {d}", .{ setting.word, @field(p.settings, @tagName(tag)) }));
} else if (!p.settings.apply(p.tape, setting, arg, p.sessionHome())) {
var said: pardes.Kind.Buf(96) = .{};
- p.reportFailure(v.active, said.print("{s}{s}: takes {s}", .{ setting.word, if (tag == .tab) ": invalid tab width" else "", comptime config.Runtime.takes(tag).? }));
+ p.reportFailure(v.active, said.print("{s}{s}: takes {s}", .{ setting.word, if (tag == .tab) ": invalid tab width" else "", comptime config.Settings.takes(tag).? }));
},
// Said with what it takes: its words, its range.
else => if (!p.settings.apply(p.tape, setting, arg, p.sessionHome())) {
var buf: [160]u8 = undefined;
var text: std.Io.Writer = .fixed(&buf);
// A list of values too long for the row is cut.
- (if (config.Runtime.takes(setting.action)) |values| text.print("{s}: takes {s}", .{ setting.word, values }) else text.print("{s}: does not take that value", .{setting.word})) catch {};
+ (if (config.Settings.takes(setting.action)) |values| text.print("{s}: takes {s}", .{ setting.word, values }) else text.print("{s}: does not take that value", .{setting.word})) catch {};
p.reportFailure(v.active, text.buffered());
},
}
diff --git a/core/ninep/ctl.zig b/core/ninep/ctl.zig
index 302b916a..72b18c88 100644
--- a/core/ninep/ctl.zig
+++ b/core/ninep/ctl.zig
@@ -298,7 +298,7 @@ pub fn captured(p: *Pardes, req: Req, id: usize, exec: bool, text: []const u8, i
// ...and one that takes none, written with one (`Config extra`):
// refused as a ctl's is, not run as a shell command of that name.
if (std.mem.indexOfAny(u8, cmd, " \t")) |sp| if (std.meta.stringToEnum(Builtin, cmd[0..sp])) |b| {
- if (!builtins.registry.takesArg(b) and config.Runtime.find(cmd[0..sp]) == null) {
+ if (!builtins.registry.takesArg(b) and config.Settings.find(cmd[0..sp]) == null) {
p.fs.results_len = 0;
return refuse(p, req, "wrong #args in control message", cmd);
}
@@ -535,7 +535,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ?
// A setting this build's frontend cannot show (Lift, GripWidth on a
// terminal, the window's own words in a terminal's view) is known,
// and says so rather than sound misspelt.
- if (builtins.absentWhy(word) orelse if (config.Runtime.find(word) != null or std.meta.stringToEnum(Builtin, word) != null) @as([]const u8, "GUI-only") else null) |absent| {
+ if (builtins.absentWhy(word) orelse if (config.Settings.find(word) != null or std.meta.stringToEnum(Builtin, word) != null) @as([]const u8, "GUI-only") else null) |absent| {
var why: pardes.Kind.Buf(64) = .{};
// EINVAL, a request this build cannot take, in words 9ns reads
// as that: `invalid`.
@@ -553,7 +553,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ?
": write it to pane/<n>/ctl");
if (arg.len > 0 and !builtins.registry.takesArg(b)) return refuse(p, req, "wrong #args in control message", line);
if (arg.len == 0 and builtins.registry.requiresArg(b)) return refuse(p, req, "wrong #args in control message", line);
- const setting = config.Runtime.find(word) orelse return null;
+ const setting = config.Settings.find(word) orelse return null;
const takes = switch (setting.action) {
.theme => if (pardes.colors.themeIndex(arg) != null) true else {
// `refuse` quotes the line after it, all in the 128 bytes an
@@ -565,7 +565,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ?
var why: pardes.Kind.Buf(256) = .{};
return refuse(p, req, why.print(head ++ "{s}" ++ tail, .{pardes.colors.themesNear(near[0..@min(room, near.len)], arg)}), arg);
},
- .font => config.Runtime.FontSpec.parse(arg) != null,
+ .font => config.Settings.FontSpec.parse(arg) != null,
// Bare, it says the width, as from a pane's exec.
.tab => arg.len == 0 or (std.fmt.parseInt(u16, arg, 10) catch 0) -% 1 < 16,
.callstack_depth => arg.len == 0 or (std.fmt.parseInt(u8, arg, 10) catch 0) -% 1 < pardes.lsp.callstack_max_depth,
@@ -578,7 +578,7 @@ fn checkBuiltin(p: *Pardes, req: Req, line: []const u8, scope: builtins.Scope) ?
var why: pardes.Kind.Buf(160) = .{};
// The offending word is the value: quoted, so two bad values read,
// and log, as two.
- return refuseQuoting(p, req, if (config.Runtime.takes(setting.action)) |values|
+ return refuseQuoting(p, req, if (config.Settings.takes(setting.action)) |values|
why.print("bad value in control message; takes {s}", .{values})
else
"bad value in control message", arg, "");
@@ -628,13 +628,13 @@ fn writeSettings(p: *Pardes, w: *std.Io.Writer) !void {
/// The setting words of `s`, one a line, those a frontend of `caps` takes
/// (the root ctl's: the live view's), and the session's LocationsConfig.
-fn writeSettingsFor(p: *Pardes, s: *const config.Runtime, w: *std.Io.Writer, caps: config.Runtime.Capabilities) !void {
+fn writeSettingsFor(p: *Pardes, s: *const config.Settings, w: *std.Io.Writer, caps: config.Settings.Capabilities) !void {
// DumpConfig's words: a `# Word unsupported` comment for what `caps` lacks.
var dump_dir: [1024]u8 = undefined;
var located_buf: [256]u8 = undefined;
var located: std.Io.Writer = .fixed(&located_buf);
try p.locations_config.write(&located);
- try config.Runtime.writeSettings(w, .{
+ try config.Settings.writeSettings(w, .{
.locations = located.buffered(),
.theme_name = p.theme().name,
.theme_file = pardes.colors.loadedThemeFile(p),
@@ -879,7 +879,7 @@ fn writeCommands(p: *const Pardes, w: *std.Io.Writer) !void {
});
// A setting that chooses among words: the words, comma-joined. Bare,
// it steps to the next of them (a two-valued one flips).
- if (config.Runtime.find(@tagName(b))) |setting| if (config.Runtime.choices(setting.action)) |values| {
+ if (config.Settings.find(@tagName(b))) |setting| if (config.Settings.choices(setting.action)) |values| {
try w.writeByte(' ');
var parts = std.mem.splitSequence(u8, values, ", ");
var first = true;
@@ -887,7 +887,7 @@ fn writeCommands(p: *const Pardes, w: *std.Io.Writer) !void {
};
// Then ` -- ` and what it does: a setting's doc, else its source's.
var summary_buf: [2048]u8 = undefined;
- const summary = if (config.Runtime.find(@tagName(b))) |setting| setting.doc else summaryOf(@tagName(b), &summary_buf);
+ const summary = if (config.Settings.find(@tagName(b))) |setting| setting.doc else summaryOf(@tagName(b), &summary_buf);
if (summary.len > 0) {
// The sentence whole unless it is long, then cut between words.
const kept = @import("../Messages.zig").clip(summary, 240);
@@ -1374,7 +1374,7 @@ test "commands lists every builtin with its argument and the ctl that takes it"
const b = std.meta.stringToEnum(Builtin, words.next().?).?;
if (builtins.registry.takesArg(b)) try testing.expectEqualStrings("arg", words.next().?);
try testing.expectEqualStrings(if (b == .Edit) "both" else if (builtins.registry.scope(b) == .session) "root" else "pane", words.next().?);
- if (config.Runtime.find(@tagName(b))) |s| if (config.Runtime.choices(s.action) != null) try testing.expect(words.next() != null);
+ if (config.Settings.find(@tagName(b))) |s| if (config.Settings.choices(s.action) != null) try testing.expect(words.next() != null);
// Then, where the source has one, ` -- ` and what it does.
if (words.next()) |dashes| try testing.expectEqualStrings("--", dashes);
}
@@ -1766,7 +1766,7 @@ test "after a ThemeFile the root ctl and DumpConfig say ThemeFile and its path,
try testing.expect(std.mem.indexOf(u8, settings, "Theme mine") == null);
var storage: [16384]u8 = undefined;
var out: std.Io.Writer = .fixed(&storage);
- try config.Runtime.writeReport(&out, .{
+ try config.Settings.writeReport(&out, .{
.startup_config_path = null,
.platform = @tagName(pardes.platform),
.theme_name = p.theme().name,
@@ -2490,7 +2490,7 @@ test "every word's /commands description is its own doc comment's first sentence
continue;
};
const word = line[0..std.mem.indexOfScalar(u8, line, ' ').?];
- if (config.Runtime.find(word)) |setting| {
+ if (config.Settings.find(word)) |setting| {
try testing.expect(std.mem.endsWith(u8, line, setting.doc));
continue;
}
@@ -2890,7 +2890,7 @@ test "the init file reads past a BOM, and every line it fails is a notice and an
}
test "a setting the other frontend has is passed over in the init file, not failed" {
- const other = for (config.Runtime.settings) |s| {
+ const other = for (config.Settings.settings) |s| {
if (!s.enabled(pardes.builtins.capabilities)) break s.word;
} else return; // this frontend has them all
var text: [64]u8 = undefined;
diff --git a/core/surface.zig b/core/surface.zig
index fdcb52c8..6e05f25f 100644
--- a/core/surface.zig
+++ b/core/surface.zig
@@ -221,7 +221,7 @@ pub const Facts = struct {
forward: bool = false,
cursor_blink: bool = true,
jump_trail: bool = false,
- pet: config.Runtime.Pet = .off,
+ pet: config.Settings.Pet = .off,
inactive_dim: u8 = 0,
tagline_percent: u8 = 100,
diff --git a/dev/gui/gui.zig b/dev/gui/gui.zig
index c147c2e2..3aed1ed6 100644
--- a/dev/gui/gui.zig
+++ b/dev/gui/gui.zig
@@ -595,7 +595,7 @@ fn acknowledgeGuiFont(g: *const Gui, core: *pardes.Pardes) void {
/// A replica client's font is the window's raster state: it follows the
/// session's request by the face's name on this machine (fonts.fromSession),
/// never acknowledging it or otherwise changing the replicated core.
-fn syncReplicaFont(g: *Gui, f: *const @FieldType(pardes.config.Runtime, "font"), gpa: std.mem.Allocator) bool {
+fn syncReplicaFont(g: *Gui, f: *const @FieldType(pardes.config.Settings, "font"), gpa: std.mem.Allocator) bool {
const path = f.requested_path.get();
const name = f.requested_name.get();
if (path.len == 0 and name.len == 0) return false;
@@ -5857,7 +5857,7 @@ fn cursorDecor(g: *Gui, gpa: std.mem.Allocator, surface: *const pardes.Surface,
/// The triangle overlay: the cursor's glide, over everything.
fn buildOverlay(
g: *Gui,
- which: pardes.config.Runtime.Pet,
+ which: pardes.config.Settings.Pet,
trail_on: bool,
surface: *const pardes.Surface,
now_ns: u64,
@@ -5906,7 +5906,7 @@ fn appendJumpTrail(g: *Gui, on: bool, surface: *const pardes.Surface, now_ns: u6
/// The workspace tag's pet (the Pet setting, gui/pet.zig): in the blank
/// end of the grid's first row, past the tag's text, in the tag's colours,
/// on the window's own clock. Nothing of it reaches the core.
-fn appendWorkspacePet(g: *Gui, which: pardes.config.Runtime.Pet, surface: *const pardes.Surface, builder: *OverlayBuilder) void {
+fn appendWorkspacePet(g: *Gui, which: pardes.config.Settings.Pet, surface: *const pardes.Surface, builder: *OverlayBuilder) void {
const kind: pet.Kind = @fromBackingInt(@backingInt(which));
if (kind == .off or surface.rows == 0 or surface.cols == 0) {
g.pet_state = .{};
diff --git a/dev/jump_trail.zig b/dev/jump_trail.zig
index 25eba636..05664ec1 100644
--- a/dev/jump_trail.zig
+++ b/dev/jump_trail.zig
@@ -4,7 +4,7 @@
//! the cursor of the Surface it shows, frame after frame, and times the fade
//! on its own clock; the tty tints those cells' ground toward the text, the
//! window draws over them. Nothing of it reaches the core, which keeps the
-//! setting alone (config.Runtime.jump_trail).
+//! setting alone (config.Settings.jump_trail).
const std = @import("std");
pub const life_ns: u64 = 120 * std.time.ns_per_ms;
diff --git a/docs/next-winmode.md b/docs/next-winmode.md
index c2a01da8..57cfcfbf 100644
--- a/docs/next-winmode.md
+++ b/docs/next-winmode.md
@@ -36,7 +36,7 @@ Typed in one go, the `j` after `SPC d` lands 100-250 ms after the `d`
waiting to see something happen. 400 ms clears a relaxed typist with margin
and is still quick enough to read as "it is asking", not "it is broken".
Key-hint popups elsewhere (which-key) wait a few hundred ms for the same reason. It is a compile-time
-constant beside `del_question` (keys are compiled in); a Runtime setting
+constant beside `del_question` (keys are compiled in); a `Settings` field
would be one line in config if the author wants to tune it live.
## Tests
diff --git a/runtime/main.zig b/runtime/main.zig
index 2b600d63..448dfa57 100644
--- a/runtime/main.zig
+++ b/runtime/main.zig
@@ -753,7 +753,7 @@ const Word = struct {
/// Its group: the first key after the leader, else what it is.
fn group(w: Word) []const u8 {
if (std.mem.indexOf(u8, w.doc, " (addon ") != null and std.mem.endsWith(u8, w.doc, ")")) return "addon";
- if (pardes.config.Runtime.find(w.name) != null) return "setting";
+ if (pardes.config.Settings.find(w.name) != null) return "setting";
if (std.meta.stringToEnum(pardes.builtins.registry.Builtin(), w.name)) |b| if (pardes.config.leader_path.get(b)) |p| switch (p[0]) {
'f' => return "file",
'c' => return "column",
diff --git a/test/output.zig b/test/output.zig
index 38e8ba0d..4b9e7678 100644
--- a/test/output.zig
+++ b/test/output.zig
@@ -549,7 +549,7 @@ test "a window's setting builtins (TaglineSize, Font) reach the report DumpConfi
defer font_arena.deinit();
var chosen_font: ?[]const u8 = null;
var buf: [512]u8 = undefined;
- for (config.Runtime.settings) |setting| {
+ for (config.Settings.settings) |setting| {
// The view's own (a terminal's takes no window's words).
if (!setting.enabled(builtins.viewCapabilities(p))) continue;
const command: []const u8 = switch (setting.action) {