summaryrefslogtreecommitdiff
path: root/src/ninep/pty.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/ninep/pty.zig')
-rw-r--r--src/ninep/pty.zig4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig
index 5a974adf..b913e83b 100644
--- a/src/ninep/pty.zig
+++ b/src/ninep/pty.zig
@@ -137,7 +137,7 @@ pub fn readCtl(p: *Pardes, req: Req, pane: *Pane) Reply {
}
/// The pty's size: what ctl's winsize set, else the pane's grid.
-fn winsize(pane: *const Pane) [2]u16 {
+pub fn winsize(pane: *const Pane) [2]u16 {
return pane.fs.winsize orelse .{ pane.cols, pane.rows };
}
@@ -591,6 +591,8 @@ test "every pty/ctl verb, and every refusal" {
try testing.expectEqual(rows, pane.rows);
// ctl and status read back the pty's size, until the pane resizes.
try testing.expectEqualStrings("winsize 132 44\n", rd(p, ctl, 0, 64).bytes);
+ // Its stat is that read's length, which a mount reads up to.
+ try testing.expectEqual(@as(u64, "winsize 132 44\n".len), call(p, .{ .tag = 1, .op = .getattr, .node = ctl }).reply.attr.size);
try testing.expect(std.mem.startsWith(u8, rd(p, Node.of(serialOf(p), .pty_status), 0, 64).bytes, " 132 44 "));
p.update(.{ .resize = .{ .cols = 76, .rows = 24 } });
try testing.expect(pane.cols != 132);