From 4db57bf5bd788a292fcf2cfbea3b6d8b281510f0 Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Thu, 1 Oct 2026 10:31:23 -0300 Subject: Saving the init file in a pane (Config) applies its settings at once; its commands are not run a second time A setting changed in the init file took effect only at the next start. The host's Save now hands a written init file's text back to the core, which applies its setting lines again (each idempotent), with the same notice and err for one that fails; a command line in it (`Newcol`) belongs to the start and is left alone. Co-Authored-By: Claude Opus 5.5 --- src/ninep/ctl.zig | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/ninep') diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index 2fa0cd7e..cd8bc6c9 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -4477,3 +4477,14 @@ test "the init file reads past a BOM, and every line it fails is a notice and an try testing.expect(!th.logHas(p, "line 4")); try testing.expect(th.logHas(p, "err - init file line 5: ")); } + +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(); + const cols = p.ncol; + pardes.exec.reapplyInitFile(p, "/tmp/pardes-init-test/elsewhere", "Theme acme\n"); + try testing.expectEqualStrings("dusk", p.theme().name); + pardes.exec.reapplyInitFile(p, "/tmp/pardes-init-test/init", "Theme acme\nNewcol\n"); + try testing.expectEqualStrings("acme", p.theme().name); + try testing.expectEqual(cols, p.ncol); +} -- cgit v1.3