fix: optimize height calculations for ask_user dialog (#19017)

This commit is contained in:
Jack Wotherspoon
2026-02-18 10:52:30 -05:00
committed by GitHub
parent 05be2b51fc
commit 22763c98b0
4 changed files with 84 additions and 9 deletions
@@ -235,6 +235,10 @@ export const ToolConfirmationMessage: React.FC<
return undefined;
}
if (handlesOwnUI) {
return availableTerminalHeight;
}
// Calculate the vertical space (in lines) consumed by UI elements
// surrounding the main body content.
const PADDING_OUTER_Y = 2; // Main container has `padding={1}` (top & bottom).
@@ -253,7 +257,7 @@ export const ToolConfirmationMessage: React.FC<
1; // Reserve one line for 'ShowMoreLines' hint
return Math.max(availableTerminalHeight - surroundingElementsHeight, 1);
}, [availableTerminalHeight, getOptions]);
}, [availableTerminalHeight, getOptions, handlesOwnUI]);
const { question, bodyContent, options } = useMemo(() => {
let bodyContent: React.ReactNode | null = null;