summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 03:13:10 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:15 -0300
commit6dfc6838c1c02978c026b650d69f87f23e3ff81c (patch)
treea488db19607f2a1a7759f2e66a4688182e371124 /src/ninep
parent073695995ecf4a269da8d338b23bfab1d3369c05 (diff)
downloadpardes-6dfc6838c1c02978c026b650d69f87f23e3ff81c.tar.gz
pardes-6dfc6838c1c02978c026b650d69f87f23e3ff81c.zip
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 <[email protected]>
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/cols.zig22
1 files changed, 22 insertions, 0 deletions
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].?));
+}