diff options
| author | Gabriel Schneider <[email protected]> | 2026-11-19 23:51:23 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-11-20 00:00:00 -0300 |
| commit | 8a1f65a2d374796b9b5559c4aab87c8d1e8f6e68 (patch) | |
| tree | 24c4d770b8ac5a11e1f0169f9e0707fda8cde678 /core/ninep/ctl.zig | |
| parent | d236dff22567c2f563756695598678afb84fbef4 (diff) | |
| parent | a310585195484b8420f14cff3e736c604f47c11e (diff) | |
| download | pardes-8a1f65a2d374796b9b5559c4aab87c8d1e8f6e68.tar.gz pardes-8a1f65a2d374796b9b5559c4aab87c8d1e8f6e68.zip | |
integration: the ruled renames on the documents and the load-independent tests: pardes-renames (config.Settings, macos.Callbacks, core/ninep/harness.zig, Pane.docked_to and the word Undock) and pardes-merge23; one conflict, in core/CHANGELOG.md, where both sides added Unreleased entries: both kept; no old name left in the tree; tui core-test 848/991 (143 skipped), shell-test 1027/1030, the window builds
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Claude-Session: https://claude.ai/code/session_016Y9MNBECMWcJD5pdS4SR6T
Diffstat (limited to 'core/ninep/ctl.zig')
| -rw-r--r-- | core/ninep/ctl.zig | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/core/ninep/ctl.zig b/core/ninep/ctl.zig index 302b916a..7b4e2754 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); @@ -1323,7 +1323,7 @@ pub fn get(p: *Pardes, pane: *Pane) GetError!void { // ---- tests ---- const testing = std.testing; -const th = @import("testing.zig"); +const th = @import("harness.zig"); const call = th.call; const rd = th.rd; const wr = th.wr; @@ -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; |
