From 4c71e694ba9ac4286f479bd763e9719993708edd Mon Sep 17 00:00:00 2001 From: Taylor Ho Date: Fri, 22 May 2026 00:17:18 -0700 Subject: [PATCH] =?UTF-8?q?fix(terminal):=20cap=20max=20height=20at=2050%?= =?UTF-8?q?=20viewport=20=E2=80=94=20always=20leaves=20room=20for=20chat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- desktop/src/features/terminal/TerminalPanel.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/desktop/src/features/terminal/TerminalPanel.tsx b/desktop/src/features/terminal/TerminalPanel.tsx index 1b8f336180..bd4d9fa83c 100644 --- a/desktop/src/features/terminal/TerminalPanel.tsx +++ b/desktop/src/features/terminal/TerminalPanel.tsx @@ -8,11 +8,14 @@ const TERMINAL_MAX_HEIGHT_PX = 600; const TERMINAL_DEFAULT_HEIGHT_PX = 280; const TERMINAL_HEIGHT_SESSION_KEY = "sprout.desktop.terminal-panel-height"; +function getMaxHeight(): number { + if (typeof window === "undefined") return TERMINAL_MAX_HEIGHT_PX; + // Never exceed 50% of viewport — leaves room for header, composer, and chat + return Math.min(TERMINAL_MAX_HEIGHT_PX, Math.floor(window.innerHeight * 0.5)); +} + function clampTerminalHeight(height: number): number { - return Math.max( - TERMINAL_MIN_HEIGHT_PX, - Math.min(TERMINAL_MAX_HEIGHT_PX, height), - ); + return Math.max(TERMINAL_MIN_HEIGHT_PX, Math.min(getMaxHeight(), height)); } function getInitialTerminalHeight(): number {