From 6dfc6838c1c02978c026b650d69f87f23e3ff81c Mon Sep 17 00:00:00 2001 From: Gabriel Schneider Date: Tue, 29 Sep 2026 03:13:10 -0300 Subject: Words from the workspace and column tags run in the session's directory A command or Tty run from the workspace tag or a column tag started in the focused pane's directory, though those tags have none of their own. As acme's row and column tags do, they now run in the session's directory, where pardes started (Pardes.sessionDir); a pane's tag and text keep the pane's. The same for /tagexec, a column's exec and ctl. Co-Authored-By: Claude Opus 5.5 --- src/ninep/cols.zig | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/ninep') diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index ad7d30f8..c55c1e73 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -140,6 +140,8 @@ pub fn writeCtl(p: *Pardes, req: Req, serial: u32) Reply { const col = layout.columnBySerial(p, serial) orelse return Reply.fail(req.tag, E.NOENT); p.exec_column = col; defer p.exec_column = null; + p.exec_header = true; + defer p.exec_header = false; if (pardes.ctlfs.ctl.runBuiltin(p, req, p.active, line)) |refusal| return refusal; } return .{ .tag = req.tag, .written = @intCast(req.data.len) }; @@ -163,6 +165,8 @@ pub fn writeExec(p: *Pardes, req: Req, serial: ?u32) Reply { if (p.panes[p.active] == null) return Reply.fail(req.tag, E.NOENT); p.exec_column = col; defer p.exec_column = null; + p.exec_header = true; + defer p.exec_header = false; pardes.ctlfs.ctl.run(p, p.active, true, line, true); } return .{ .tag = req.tag, .written = @intCast(req.data.len) }; @@ -315,3 +319,21 @@ test "tagexec runs a word as a click in the workspace tag; exec files read back try testing.expectEqual(tree.Status.ok, th.wr(p, Node.ofCol(right, .exec), "Msg from a column\n").reply.status); try testing.expect(th.logHas(p, "msg - from a column\n")); } + +test "a word run from the workspace's or a column's tag runs in the session's directory, a pane's in its own" { + const p = try th.withFile(testing.allocator, "x\n"); + defer p.deinit(); + const session = p.sessionDir(); + try testing.expect(!std.mem.eql(u8, session, pardes.Pardes.paneDir(p.panes[0].?))); // the file is elsewhere + const dirs = [_]u64{ @intFromEnum(tree.TopFile.tagexec), Node.ofCol(layout.columnSerial(p, 0), .exec) }; + for (dirs) |node| { + try testing.expectEqual(tree.Status.ok, th.wr(p, node, "true\n").reply.status); + const made = p.paneBySerial(p.fs.results[0]).?; + try testing.expectEqualStrings(session, pardes.Pardes.paneDir(p.panes[made].?)); + try p.removePane(made, null); + } + const from_pane = p.panes[0].?.serial; + _ = th.wr(p, Node.of(from_pane, .exec), "true\n"); + const made = p.paneBySerial(p.fs.results[0]).?; + try testing.expectEqualStrings(pardes.Pardes.paneDir(p.panes[0].?), pardes.Pardes.paneDir(p.panes[made].?)); +} -- cgit v1.3