summaryrefslogtreecommitdiff
path: root/core/config.zig
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 /core/config.zig
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
Diffstat (limited to 'core/config.zig')
-rw-r--r--core/config.zig34
1 files changed, 17 insertions, 17 deletions
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);
}
}