summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/exec.zig6
-rw-r--r--src/ninep/ctl.zig10
2 files changed, 15 insertions, 1 deletions
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();