diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index 472573dafc..769e0f7fcc 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -12,7 +12,6 @@ import { useEffect, useReducer, useContext, - useState, } from 'react'; import { Box, Text } from 'ink'; import { theme } from '../semantic-colors.js'; @@ -783,8 +782,6 @@ const ChoiceQuestionView: React.FC = ({ } }, [customOptionText, isCustomOptionSelected, question.multiSelect]); - const [actualQuestionHeight, setActualQuestionHeight] = useState(0); - const HEADER_HEIGHT = progressHeader ? 2 : 0; const TITLE_MARGIN = 1; const FOOTER_HEIGHT = 2; // DialogFooter + margin @@ -794,38 +791,19 @@ const ChoiceQuestionView: React.FC = ({ ? Math.max(1, availableHeight - overhead) : undefined; - const idealOptionsHeight = selectionItems.reduce( - (acc, item) => acc + (item.value.description ? 2 : 1), - 0, - ); - - // Use remaining height for the question, reserving space for the options list - const maxQuestionHeight = - question.unconstrainedHeight && listHeight - ? Math.max(5, listHeight - Math.min(idealOptionsHeight, 10)) - : 15; + const minListHeight = 6; // Reserve ~6 lines for options list to avoid squishing const questionHeightLimit = listHeight && !isAlternateBuffer - ? Math.min(maxQuestionHeight, listHeight) + ? question.unconstrainedHeight + ? Math.max(1, listHeight - minListHeight) + : Math.min(15, Math.max(1, listHeight - DIALOG_PADDING)) : undefined; - let maxItemsToShow = selectionItems.length; - if (listHeight && actualQuestionHeight) { - const remainingHeight = Math.max(0, listHeight - actualQuestionHeight); - let linesUsed = 0; - let itemsThatFit = 0; - for (const item of selectionItems) { - const itemLines = item.value.description ? 2 : 1; - if (linesUsed + itemLines <= remainingHeight) { - linesUsed += itemLines; - itemsThatFit++; - } else { - break; - } - } - maxItemsToShow = Math.max(1, itemsThatFit); - } + const maxItemsToShow = + listHeight && questionHeightLimit + ? Math.max(1, Math.floor((listHeight - questionHeightLimit) / 2)) + : selectionItems.length; return ( @@ -835,7 +813,6 @@ const ChoiceQuestionView: React.FC = ({ maxHeight={questionHeightLimit} maxWidth={availableWidth} overflowDirection="bottom" - onHeightChange={setActualQuestionHeight} > Scroll Arrows (useAlternateBuffer: false) > shows scrol Description 1 2. Option 2 Description 2 - 3. Option 3 - Description 3 ▼ Enter to select · ↑/↓ to navigate · Esc to cancel diff --git a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap index 7113805a82..073c106ceb 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -74,8 +74,7 @@ Implementation Steps 6. Add LDAP provider support in src/auth/providers/LDAPProvider.ts 7. Create token refresh mechanism in src/auth/TokenManager.ts 8. Add multi-factor authentication in src/auth/MFAService.ts - 9. Implement session timeout handling in src/auth/SessionManager.ts -... last 21 lines hidden (Ctrl+O to show) ... +... last 22 lines hidden (Ctrl+O to show) ... ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically diff --git a/packages/cli/src/ui/components/shared/MaxSizedBox.tsx b/packages/cli/src/ui/components/shared/MaxSizedBox.tsx index f365fea9a4..ee91d34f57 100644 --- a/packages/cli/src/ui/components/shared/MaxSizedBox.tsx +++ b/packages/cli/src/ui/components/shared/MaxSizedBox.tsx @@ -26,7 +26,6 @@ interface MaxSizedBoxProps { maxHeight?: number; overflowDirection?: 'top' | 'bottom'; additionalHiddenLinesCount?: number; - onHeightChange?: (height: number) => void; } /** @@ -39,7 +38,6 @@ export const MaxSizedBox: React.FC = ({ maxHeight, overflowDirection = 'top', additionalHiddenLinesCount = 0, - onHeightChange, }) => { const id = useId(); const { addOverflowingId, removeOverflowingId } = useOverflowActions() || {}; @@ -82,18 +80,6 @@ export const MaxSizedBox: React.FC = ({ ? effectiveMaxHeight - 1 : effectiveMaxHeight; - const actualHeight = - visibleContentHeight !== undefined - ? Math.min(contentHeight, visibleContentHeight) - : contentHeight; - - const totalActualHeight = - actualHeight + (isOverflowing && effectiveMaxHeight !== undefined ? 1 : 0); - - useEffect(() => { - onHeightChange?.(totalActualHeight); - }, [totalActualHeight, onHeightChange]); - const hiddenLinesCount = visibleContentHeight !== undefined ? Math.max(0, contentHeight - visibleContentHeight)