From 85f04447ea489f71f2872fcee11e904ab35c46c5 Mon Sep 17 00:00:00 2001 From: Fusion Date: Sun, 24 May 2026 18:47:27 +0200 Subject: [PATCH] fix: force xterm.js canvas redraw on resize via internal renderer --- apps/web/src/components/terminal.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) 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); }