╭ changed ──────╮ │src/ssh_tui.zig│ ╰───────────────╯ ╭───────────╮ │← all files│ ╰───────────╯ ╭──────────────────────────────────────────────────────────────────────────────────╮ │269 } │ │270 │ │271 const WinSize = struct { width: u16, height: u16 }; │ │272 + │ │273 +// fall back to a conventional 80x24 if the PTY hasn't been told a size yet —│ │274 +// this happens when the SSH client has no local controlling terminal (e.g. │ │275 +// non-interactive piped input) and never sends a window-change request. │ │276 +const default_width: u16 = 80; │ │277 +const default_height: u16 = 24; │ │278 │ │279 fn getWinSize() !WinSize { │ │280 var ws: std.posix.winsize = undefined; │ ╰──────────────────────────────────────────────────────────────────────────────────╯ ╭─────────────────────────────────────────────────────────────────────────────────────────────────────────╮ │281 const rc = std.os.linux.ioctl(std.posix.STDOUT_FILENO, std.posix.T.IOCGWINSZ, @intFromPtr(&ws));│ │282 if (std.posix.errno(rc) != .SUCCESS) return error.IoctlFailed; │ │277 - return .{ .width = ws.col, .height = ws.row }; │ │283 + return .{ │ │284 + .width = if (ws.col == 0) default_width else ws.col, │ │285 + .height = if (ws.row == 0) default_height else ws.row, │ │286 + }; │ │287 } │ │288 │ │289 const StdinThreadCtx = struct { │ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────╯