From 0a6fb84bec0271ace3f96a1707bc4fb42a2a3f1e Mon Sep 17 00:00:00 2001 From: "A.K.M. Adib" Date: Fri, 6 Mar 2026 14:40:46 -0500 Subject: [PATCH] prevent radio button area from getting truncated --- .../cli/src/ui/components/AskUserDialog.tsx | 29 +++++++++++++++---- .../ExitPlanModeDialog.test.tsx.snap | 6 ++-- 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/packages/cli/src/ui/components/AskUserDialog.tsx b/packages/cli/src/ui/components/AskUserDialog.tsx index a97c0b1e2b..472573dafc 100644 --- a/packages/cli/src/ui/components/AskUserDialog.tsx +++ b/packages/cli/src/ui/components/AskUserDialog.tsx @@ -794,10 +794,15 @@ const ChoiceQuestionView: React.FC = ({ ? Math.max(1, availableHeight - overhead) : undefined; - // Modulo the fixed overflow (overhead + 4 lines reserved for list), use all remaining height. + 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 - 4) + ? Math.max(5, listHeight - Math.min(idealOptionsHeight, 10)) : 15; const questionHeightLimit = @@ -805,10 +810,22 @@ const ChoiceQuestionView: React.FC = ({ ? Math.min(maxQuestionHeight, listHeight) : undefined; - const maxItemsToShow = - listHeight && actualQuestionHeight - ? Math.max(1, Math.floor((listHeight - actualQuestionHeight) / 2)) - : selectionItems.length; + 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); + } return ( 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 0c58bb2ce8..7113805a82 100644 --- a/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap +++ b/packages/cli/src/ui/components/__snapshots__/ExitPlanModeDialog.test.tsx.snap @@ -75,15 +75,13 @@ Implementation Steps 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 - 10. Add audit logging for auth events in src/auth/AuditLogger.ts -... last 20 lines hidden (Ctrl+O to show) ... +... last 21 lines hidden (Ctrl+O to show) ... -▲ ● 1. Yes, automatically accept edits Approves plan and allows tools to run automatically 2. Yes, manually accept edits Approves plan but requires confirmation for each tool -▼ + 3. Type your feedback... Enter to select · ↑/↓ to navigate · Ctrl+X to edit plan · Esc to cancel "