From 55005529939f1d95d4c177df872ac6c2844499f4 Mon Sep 17 00:00:00 2001 From: Fusion Date: Sun, 24 May 2026 15:42:22 +0200 Subject: [PATCH] fix: send terminal resize immediately on WebSocket connect - Backend PTY starts with default 80x24 dimensions - Previous code only sent resize during layout changes - Now sends current terminal size immediately when WebSocket opens - Ensures PTY is properly sized before shell starts rendering --- apps/web/src/components/terminal.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/apps/web/src/components/terminal.tsx b/apps/web/src/components/terminal.tsx index fc64b1e..e1e6073 100644 --- a/apps/web/src/components/terminal.tsx +++ b/apps/web/src/components/terminal.tsx @@ -79,6 +79,13 @@ export const TerminalComponent: React.FC = ({ reconnectAttemptsRef.current = 0; lastPingRef.current = Date.now(); + // Send current terminal size immediately on connect + if (termRef.current) { + const { cols, rows } = termRef.current; + console.log(`[Terminal] Sending resize on connect: ${cols}x${rows}`); + ws.send(JSON.stringify({ type: "resize", cols, rows })); + } + // Start heartbeat check if (heartbeatCheckRef.current) { window.clearInterval(heartbeatCheckRef.current);