summaryrefslogtreecommitdiff
path: root/src/ninep
diff options
context:
space:
mode:
authorGabriel Schneider <[email protected]>2026-09-29 09:01:46 -0300
committerGabriel Schneider <[email protected]>2026-10-01 00:12:16 -0300
commit039ae6aa70d963f942d8a5747060c67599664af9 (patch)
tree3f6448c9a7b3db81a076edeefce081990a9eea24 /src/ninep
parente0a2fd56777cf0f571125650ec74e75c3f6a8c44 (diff)
downloadpardes-039ae6aa70d963f942d8a5747060c67599664af9.tar.gz
pardes-039ae6aa70d963f942d8a5747060c67599664af9.zip
A terminal is typed into only when idle at an empty prompt
A look at a directory, or an exec at a terminal, typed its line after whatever sat unsent at the prompt and ran the two joined (`echo TYPEDls`). A terminal with text at its prompt now takes no line; a look at its directory opens a new terminal, an exec runs as a command pane. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep')
-rw-r--r--src/ninep/ctl.zig26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/ninep/ctl.zig b/src/ninep/ctl.zig
index d1f920a2..95d81e3b 100644
--- a/src/ninep/ctl.zig
+++ b/src/ninep/ctl.zig
@@ -1886,6 +1886,32 @@ test "a terminal told the directory it already goes by logs no rename" {
try testing.expect(th.logHas(p, try std.fmt.bufPrint(&rec, "rename {d} /usr", .{p.panes[term].?.serial})));
}
+test "a terminal with text typed at its prompt is never typed into: a look at its directory opens another" {
+ const p = try th.withTerm(testing.allocator);
+ defer p.deinit();
+ const term = p.paneBySerial(serialOf(p)).?;
+ p.setCwd(term, "/tmp");
+ p.update(.{ .output = .{ .pane = @intCast(term), .bytes = "\x1b]133;A;aid=pardes\x07$ \x1b]133;B;aid=pardes\x07TYPED" } });
+ while (p.nextEffect()) |_| {}
+ var count: usize = 0;
+ for (p.panes) |slot| count += @intFromBool(slot != null);
+ try testing.expectEqual(Status.ok, wr(p, @intFromEnum(tree.TopFile.look), "/tmp\n").reply.status);
+ var typed_into = false;
+ while (p.nextEffect()) |effect| if (effect == .write and effect.write.pane == term) {
+ typed_into = true;
+ };
+ try testing.expect(!typed_into);
+ var after: usize = 0;
+ for (p.panes) |slot| after += @intFromBool(slot != null);
+ try testing.expectEqual(count + 1, after);
+ // An exec at it runs in a pane of its own, not typed after TYPED.
+ _ = wr(p, Node.of(serialOf(p), .exec), "echo hi\n");
+ while (p.nextEffect()) |effect| if (effect == .write and effect.write.pane == term) {
+ typed_into = true;
+ };
+ try testing.expect(!typed_into);
+}
+
test "size is monotonic: growing is never refused, and a size once taken is taken again" {
const p = try Pardes.init(testing.allocator, .{ .tty_only = true, .cols = 160, .rows = 60 });
defer p.deinit();