From 63d66e82a4ebbdf11cd12f8bc6f002075617fb94 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 11:17:09 -0300 Subject: A setting only the other frontend has (Font, GripWidth in a terminal) is passed over in the init file, not failed: one init file serves the window and the terminal Co-Authored-By: Claude Opus 5.5 --- src/exec.zig | 6 +++++- src/ninep/ctl.zig | 10 ++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/exec.zig b/src/exec.zig index 722ad3de..f3819a83 100644 --- a/src/exec.zig +++ b/src/exec.zig @@ -1005,7 +1005,11 @@ 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; - if (settings_only and config.Runtime.find(word[0 .. std.mem.indexOfAny(u8, word, " \t") orelse word.len]) == null) continue; + const setting = config.Runtime.find(word[0 .. std.mem.indexOfAny(u8, word, " \t") orelse word.len]); + if (settings_only and setting == null) continue; + // One init file serves the window and the terminal: a setting only + // the other has (Font, GripWidth in a terminal) is no failure here. + if (setting) |s| if (!s.enabled(builtins.capabilities)) continue; const failures = p.fs.failures; const known = executeBuiltinLine(p, p.active, line); if (known and p.fs.failures == failures) continue; diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index d4751191..adfc91fa 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -4561,6 +4561,16 @@ test "the init file reads past a BOM, and every line it fails is a notice and an try testing.expect(th.logHas(p, "err - init file line 5: ")); } +test "a setting the other frontend has is passed over in the init file, not failed" { + const other = for (config.Runtime.settings) |s| { + if (!s.enabled(pardes.builtins.capabilities)) break s.word; + } else return; // this frontend has them all + var text: [64]u8 = undefined; + const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .startup_config = try std.fmt.bufPrint(&text, "{s} 1\n", .{other}) }); + defer p.deinit(); + try testing.expect(!th.logHas(p, "init file line")); +} + test "the init file saved in a pane applies its settings again, and runs none of its commands twice" { const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .startup_config = "Theme dusk\n", .startup_config_path = "/tmp/pardes-init-test/init" }); defer p.deinit(); -- cgit v1.3