diff options
| author | Gabriel Schneider <[email protected]> | 2026-09-29 06:16:52 -0300 |
|---|---|---|
| committer | Gabriel Schneider <[email protected]> | 2026-10-01 00:12:16 -0300 |
| commit | c78641fdbe931ca2e6e87eb3e001bd021c1eba3f (patch) | |
| tree | 340b3c2a74c88777c3078533709efaad0e25a198 /src/ninep/pty.zig | |
| parent | 4dc55f7e3ae8232e6994b92e6b1948bd8c190baf (diff) | |
| download | pardes-c78641fdbe931ca2e6e87eb3e001bd021c1eba3f.tar.gz pardes-c78641fdbe931ca2e6e87eb3e001bd021c1eba3f.zip | |
A pty/ctl winsize gives a terminal two rows at least, so it no longer reads busy for ever
A one-row pty loses the prompt's input mark as soon as the prompt wraps,
and busy detection never sees the shell idle again. Placement already
keeps a new terminal at tag + 2 rows; a winsize write now keeps the pty
at two. A pane dragged down to one body row keeps a one-row pty, since
a taller pty than the pane shows would put its cursor below the pane.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Diffstat (limited to 'src/ninep/pty.zig')
| -rw-r--r-- | src/ninep/pty.zig | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/ninep/pty.zig b/src/ninep/pty.zig index 046a456a..4009af49 100644 --- a/src/ninep/pty.zig +++ b/src/ninep/pty.zig @@ -28,6 +28,9 @@ fn dimension(word: []const u8) ?u16 { return if (n == 0 or n > winsize_max) null else n; } +/// The fewest rows a winsize write gives a terminal's pty. +pub const pty_rows_min = 2; + /// As the root ctl's `size` (4096 a side). const winsize_max = 4096; const e_winsize_range = std.fmt.comptimePrint("invalid winsize: out of range, 1x1 to {d}x{d}", .{ winsize_max, winsize_max }); @@ -71,7 +74,9 @@ fn verb(p: *Pardes, id: usize, line: []const u8, apply: bool) bool { switch (v) { .winsize => { const cols = dimension(words.next() orelse return false) orelse return false; - const rows = dimension(words.next() orelse return false) orelse return false; + // Two rows at least, as a pane is laid out: a one-row pty + // loses its prompt's input mark and reads busy for ever. + const rows = @max(pty_rows_min, dimension(words.next() orelse return false) orelse return false); if (words.next() != null) return false; if (!apply) return true; p.emit(.{ .resize_pty = .{ .pane = @intCast(id), .cols = cols, .rows = rows } }); |
