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
This commit is contained in:
Fusion
2026-05-24 15:42:22 +02:00
parent fed49dba6d
commit 5500552993
+7
View File
@@ -79,6 +79,13 @@ export const TerminalComponent: React.FC<TerminalProps> = ({
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);