summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 11:38:12 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit0f16886d2f8f53b8d746341e3e2c9fc55f2446c2 (patch)
tree9a2de305577032340dc8d928762017277c2e96aa /src
parent03a96b0b49e1927548b4bb37e2b4eb58be14f5b7 (diff)
downloadpardes-0f16886d2f8f53b8d746341e3e2c9fc55f2446c2.tar.gz
pardes-0f16886d2f8f53b8d746341e3e2c9fc55f2446c2.zip
A list pane opened from a terminal that has not said its directory yet lands in the session's
ThemeSel (Themes) in an init file ran at a terminal whose shell had not reported its cwd, so +Themes opened as /+Themes. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/Output.zig5
-rw-r--r--src/exec.zig3
2 files changed, 7 insertions, 1 deletions
diff --git a/src/Output.zig b/src/Output.zig
index b3c31be2..1461757f 100644
--- a/src/Output.zig
+++ b/src/Output.zig
@@ -669,7 +669,10 @@ pub fn openFonts(p: *Pardes, id: usize) !void {
fn openStepped(p: *Pardes, id: usize, from: Origin, content: []u8) !void {
errdefer p.gpa.free(content);
const pane = p.panes[id] orelse return error.MissingPane;
- const dir = if (pane.file) |f| (std.fs.path.dirname(f.path) orelse "/") else pane.cwdSlice();
+ const own = if (pane.file) |f| (std.fs.path.dirname(f.path) orelse "/") else pane.cwdSlice();
+ // A terminal whose shell has not said where it is yet (an init file's
+ // word at boot): the session's directory, not `/`.
+ const dir = if (own.len == 0) p.sessionDir() else own;
const free = p.freeSlot() orelse return error.NoPaneSlots;
_ = try open(p, free, dir, from, "", content);
exec.placeNew(p, id, id, free, .doc);
diff --git a/src/exec.zig b/src/exec.zig
index 421bfd13..0e9fb6d7 100644
--- a/src/exec.zig
+++ b/src/exec.zig
@@ -831,6 +831,9 @@ test "an init file's ThemeSel runs as Themes and says it was renamed" {
listed = listed or std.meta.eql(o.from, panes.Output.Origin{ .cmd = .Themes });
};
try std.testing.expect(listed);
+ // In the session's directory, not `/`.
+ for (p.panes) |slot| if (slot) |pane| if (pane.file) |f| if (f.output != null)
+ try std.testing.expectEqualStrings(p.sessionDir(), std.fs.path.dirname(f.path).?);
var said = false;
for (p.panes) |slot| if (slot) |pane| {
said = said or std.mem.eql(u8, pane.msg[0..pane.msg_len], "ThemeSel: renamed to Themes");