diff options
Diffstat (limited to 'src/ninep')
| -rw-r--r-- | src/ninep/pane.zig | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/ninep/pane.zig b/src/ninep/pane.zig index 47fdd755..b9fa2857 100644 --- a/src/ninep/pane.zig +++ b/src/ninep/pane.zig @@ -157,6 +157,9 @@ pub fn kindOf(pane: *const Pane) []const u8 { if (pane.file != null) return "text"; if (pane.pdfPath() != null) return "pdf"; if (pane.image != null) return "image"; + // A command's pane is no shell to type into: a script choosing a + // terminal by kind must not pick one. + if (pane.command != null) return "cmd"; return "term"; } @@ -1906,3 +1909,13 @@ test "a pane's tagexec runs a word as a click in its tag, and reads back what it 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); } + +test "index names a command's pane cmd, a shell's term" { + const p = try withFile(testing.allocator, "x\n"); + defer p.deinit(); + try testing.expectEqual(Status.ok, wr(p, Node.of(serialOf(p), .exec), "true\n").reply.status); + const ran = p.panes[p.paneBySerial(p.fs.results[0]).?].?; + try testing.expectEqualStrings("cmd", kindOf(ran)); + const shell = try p.newShell(p.freeSlot().?, "/tmp"); + try testing.expectEqualStrings("term", kindOf(shell)); +} |
