diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ninep/cols.zig | 13 | ||||
| -rw-r--r-- | src/ninep/ctl.zig | 6 |
2 files changed, 19 insertions, 0 deletions
diff --git a/src/ninep/cols.zig b/src/ninep/cols.zig index c049e0f3..b1ca954c 100644 --- a/src/ninep/cols.zig +++ b/src/ninep/cols.zig @@ -227,6 +227,19 @@ test "New written to a column's exec makes its scratch in the session's director try testing.expectEqualStrings("/project/src/+New", p.panes[p.active].?.file.?.path); } +test "a tagexec word that makes, acts on and focuses no pane reads back nothing" { + const p = try th.withFile(testing.allocator, "x\n"); + defer p.deinit(); + const tagexec = @intFromEnum(tree.TopFile.tagexec); + try testing.expectEqual(tree.Status.ok, th.wr(p, tagexec, "Newcol\n").reply.status); + try testing.expectEqualStrings("", th.rd(p, tagexec, 0, 64).bytes); + // A column's New makes one, and answers it. + const col_exec = tree.Node.ofCol(layout.columnSerial(p, 0), .exec); + try testing.expectEqual(tree.Status.ok, th.wr(p, col_exec, "New\n").reply.status); + var want: [16]u8 = undefined; + try testing.expectEqualStrings(try std.fmt.bufPrint(&want, "{d}\n", .{p.panes[p.active].?.serial}), th.rd(p, col_exec, 0, 64).bytes); +} + test "New written to a column's ctl reads back the new pane alone, as its exec does" { const p = try th.withFile(testing.allocator, "x\n"); defer p.deinit(); diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig index d6230308..d86d6047 100644 --- a/src/ninep/ctl.zig +++ b/src/ninep/ctl.zig @@ -93,6 +93,12 @@ pub fn run(p: *Pardes, id: usize, exec: bool, text: []const u8, in_tag: bool) vo // touched. if (p.fs.refilled) |serial| if (p.paneBySerial(serial) != null) return noteResult(p, serial); if (went) |dst| if (p.panes[dst]) |pane| return noteResult(p, pane.serial); + // A word in a column's or the workspace's tag ran at no pane: it + // answers one only if it focused one (Newcol answers nothing). + if (p.exec_header) { + if (p.active != id) if (p.panes[p.active]) |pane| noteResult(p, pane.serial); + return; + } noteResult(p, if (exec) context else (p.panes[p.active] orelse return).serial); } |
