diff options
| author | Gabriel Schneider <[email protected]> | 2026-10-01 04:54:48 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 04:54:48 -0300 |
| commit | 2488df529cde2994c37f385cefca4db1837ed9a3 (patch) | |
| tree | 1ce74ed008f98efde5a5a79f24b2e91ae0f0b998 | |
| parent | e7aaeca8e12887e2b90aae257c41efce6847c26d (diff) | |
| download | pardes-2488df529cde2994c37f385cefca4db1837ed9a3.tar.gz pardes-2488df529cde2994c37f385cefca4db1837ed9a3.zip | |
/index names a command's pane kind cmd, not term: a script picking a terminal by kind no longer picks a pane with no shell
A command pane runs one line and takes no typing; a script choosing
`$2=="term"` to type into got one. Its kind is now cmd; a shell's stays
term.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
| -rw-r--r-- | src/fs-help.txt | 2 | ||||
| -rw-r--r-- | src/ninep/pane.zig | 13 | ||||
| -rw-r--r-- | test/fs.py | 3 |
3 files changed, 16 insertions, 2 deletions
diff --git a/src/fs-help.txt b/src/fs-help.txt index 576e2dee..1f683667 100644 --- a/src/fs-help.txt +++ b/src/fs-help.txt @@ -1,7 +1,7 @@ Pardes control filesystem ========================= README this summary; the pardes book's Scripting and Reference chapters have the rest -index a line per pane: serial kind(text|term|pdf|image) dirty name column; names hold blanks: rsplit(maxsplit=1) +index a line per pane: serial kind(text|term|cmd|pdf|image) dirty name column; names hold blanks: rsplit(maxsplit=1) status pid, version and pane count look write a line: a right click on it at the active pane; read: the serials it touched (this open's) exec write a line: a middle click, a builtin or a shell line; read the same (every exec file) 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)); +} @@ -393,7 +393,8 @@ def discovery(binary, embedded=False): while client.read('/log').decode().count('\nexit ') <= seen: assert time.monotonic() < deadline, 'diff -u never ended' time.sleep(.05) - ran = [row.split()[0] for row in client.read('/index').decode().splitlines() if row.split()[1] == 'term'] + # A command's pane is kind cmd, not term: no shell to type into. + ran = [row.split()[0] for row in client.read('/index').decode().splitlines() if row.split()[1] == 'cmd'] shown = client.read(f'/pane/{ran[-1]}/body').decode() assert '+++ diff-new.txt' in shown and '\t' not in shown, shown client.write(f'/pane/{ran[-1]}/look', b'+TWO\n') |
