From 457f0d29aeb1e44418a80e2803814a7fadc0a3c3 Mon Sep 17 00:00:00 2001 From: Fusion Date: Sun, 24 May 2026 13:15:29 +0200 Subject: [PATCH 1/5] fix: add safety guards to font size change and show buttons on all screen sizes - Add null checks and try/catch around fitAddon.fit() to prevent viewport errors - Use requestAnimationFrame to ensure DOM is stable before fitting - Remove isMobile condition from font size buttons in TerminalComponent - Font size controls now visible on both mobile and desktop terminals --- apps/web/src/components/terminal.tsx | 48 +++++++++++++++------------- 1 file changed, 26 insertions(+), 22 deletions(-) diff --git a/apps/web/src/components/terminal.tsx b/apps/web/src/components/terminal.tsx index 6c5ede1..fc267d0 100644 --- a/apps/web/src/components/terminal.tsx +++ b/apps/web/src/components/terminal.tsx @@ -266,9 +266,17 @@ export const TerminalComponent: React.FC = ({ const newSize = Math.max(MIN_FONT_SIZE, Math.min(MAX_FONT_SIZE, fontSize + delta)); setFontSize(newSize); localStorage.setItem(FONT_SIZE_KEY, newSize.toString()); - if (termRef.current) { + if (termRef.current && fitAddonRef.current) { termRef.current.options.fontSize = newSize; - fitAddonRef.current?.fit(); + requestAnimationFrame(() => { + if (termRef.current && fitAddonRef.current) { + try { + fitAddonRef.current.fit(); + } catch { + // Ignore fit errors during re-initialization + } + } + }); } }; @@ -345,26 +353,22 @@ export const TerminalComponent: React.FC = ({ )}
- {isMobile && ( - <> - - - - )} + + {onClose && (