diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 04:55:00 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | 253a5c1e036d96eada910c47eb500ed0c8e37b5c (patch) | |
| tree | 88366de4f3e17029a61b94ddb37e80795a9849fb /src/ninep/pane.zig | |
| parent | cdf4cbbf1fdd121aabdbbea33f11d5ee44d7764e (diff) | |
| download | pardes-253a5c1e036d96eada910c47eb500ed0c8e37b5c.tar.gz pardes-253a5c1e036d96eada910c47eb500ed0c8e37b5c.zip | |
A pane has a tagexec: a word run as a click in its tag
The workspace had /tagexec and a column its exec, but a pane's own tag
could be clicked only by an event record. pane/<n>/tagexec runs each line
as a click in that pane's tag (never redirected to its event reader, as a
header's is not) and reads back what it touched. The README, fs.md and
the skill list it.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pane.zig')
| -rw-r--r-- | src/ninep/pane.zig | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 8cac55d6..4a50b9a1 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -259,7 +259,7 @@ pub fn fileSize(p: *Pardes, id: usize, f: PaneFile) u64 { .dot => range_len, .limit => if (pf.limit == null) 0 else range_len, .dirty, .mark, .scroll => 2, - .look, .exec => ctl.resultsLen(p), + .look, .exec, .tagexec => ctl.resultsLen(p), // What the next read would answer, which a client can see without // parking on it. .event => if (pf.events.peek()) |record| record.len else 0, @@ -328,7 +328,7 @@ pub fn read(p: *Pardes, req: Req, id: usize, pane: *Pane, file: PaneFile) Reply .dirty => readFlag(p, req, dirtyOf(pane)), .mark => readFlag(p, req, !pf.nomark), .scroll => readFlag(p, req, !pf.noscroll), - .look, .exec => ctl.readResults(p, req), + .look, .exec, .tagexec => ctl.readResults(p, req), .event => events.readQueue(p, req, &pf.events), .pty_status => pty.readStatus(p, req, id, pane), .pty_data => pty.readData(p, req, pf), @@ -420,7 +420,9 @@ pub fn write(p: *Pardes, req: Req, id: usize, pane: *Pane, file: PaneFile) Reply .data, .xdata => writeData(p, req, pane), .sel => writeSel(p, req, pane), .dirty, .mark, .scroll => writeFlag(p, req, pane, file), - .look, .exec => ctl.command(p, req, pane.serial, file == .exec), + .look, .exec => ctl.command(p, req, pane.serial, file == .exec, false), + // A click in its tag: never an event reader's to hear (cols.writeExec). + .tagexec => ctl.command(p, req, pane.serial, true, true), .event => events.writeEvent(p, req, id), .errors => if (appendErrors(p, id, req.data)) |took| .{ .tag = req.tag, .written = @intCast(took) } @@ -1275,3 +1277,14 @@ test "a limit write that fails keeps the limit a truncation cleared before it" { _ = call(p, .{ .tag = 3, .op = .release, .node = limit }); try testing.expectEqualStrings("", rd(p, limit, 0, 100).bytes); } + +test "a pane's tagexec runs a word as a click in its tag, and reads back what it touched" { + const gpa = testing.allocator; + const p = try withFile(gpa, "x\n"); + defer p.deinit(); + const serial = serialOf(p); + try testing.expectEqual(Status.ok, wr(p, Node.of(serial, .tagexec), "Msg from the tag\n").reply.status); + try testing.expect(th.logHas(p, "from the tag")); + var want: [16]u8 = undefined; + try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{serial}), rd(p, Node.of(serial, .tagexec), 0, 64).bytes); +} |
