diff --git a/apps/web/src/components/terminal.tsx b/apps/web/src/components/terminal.tsx index 68434e4..f418772 100644 --- a/apps/web/src/components/terminal.tsx +++ b/apps/web/src/components/terminal.tsx @@ -219,9 +219,15 @@ export const TerminalComponent: React.FC = ({ if (!fitAddonRef.current || !termRef.current) return; const oldCols = termRef.current.cols; const oldRows = termRef.current.rows; + + // Force layout recalculation before fit + if (container) { + void container.offsetWidth; + void container.offsetHeight; + } + fitAddonRef.current.fit(); const { cols, rows } = termRef.current; - // Force refresh if dimensions changed if (cols !== oldCols || rows !== oldRows) { termRef.current.refresh(0, rows - 1); }