From 5577e19782d4b0684c456b6bca0292cf856695ba Mon Sep 17 00:00:00 2001 From: Fusion Date: Sun, 24 May 2026 14:57:03 +0200 Subject: [PATCH] fix: set explicit container dimensions before xterm init - Measure parent dimensions and set them on container before term.open() - Ensures FitAddon gets correct dimensions on initialization - Prevents 1-row/1-col calculation that breaks scrolling and sizing --- apps/web/src/components/terminal.tsx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/web/src/components/terminal.tsx b/apps/web/src/components/terminal.tsx index e49955d..308d02a 100644 --- a/apps/web/src/components/terminal.tsx +++ b/apps/web/src/components/terminal.tsx @@ -197,7 +197,15 @@ export const TerminalComponent: React.FC = ({ term.loadAddon(fitAddon); term.loadAddon(new WebLinksAddon()); - term.open(terminalRef.current); + // Ensure container has explicit dimensions before xterm initializes + const container = terminalRef.current; + const parentRect = container.parentElement?.getBoundingClientRect(); + if (parentRect) { + container.style.width = `${parentRect.width}px`; + container.style.height = `${parentRect.height}px`; + } + + term.open(container); // Connect WebSocket const ws = connectWebSocket();