diff options
Diffstat (limited to 'src/ninep/ctl.zig')
| -rw-r--r-- | src/ninep/ctl.zig | 26 |
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(); |
