Modernize MaxSizedBox to use <Box maxHeight> and ResizeObservers (#16565)

This commit is contained in:
Jacob Richman
2026-01-13 20:22:10 -08:00
committed by GitHub
parent 4afd3741df
commit 933bc5774f
16 changed files with 482 additions and 1436 deletions
@@ -19,7 +19,6 @@ import { RadioButtonSelect } from '../shared/RadioButtonSelect.js';
import { MaxSizedBox } from '../shared/MaxSizedBox.js';
import { useKeypress } from '../../hooks/useKeypress.js';
import { theme } from '../../semantic-colors.js';
import { useAlternateBuffer } from '../../hooks/useAlternateBuffer.js';
import { useSettings } from '../../contexts/SettingsContext.js';
export interface ToolConfirmationMessageProps {
@@ -41,7 +40,6 @@ export const ToolConfirmationMessage: React.FC<
}) => {
const { onConfirm } = confirmationDetails;
const isAlternateBuffer = useAlternateBuffer();
const settings = useSettings();
const allowPermanentApproval =
settings.merged.security?.enablePermanentToolApproval ?? false;
@@ -273,20 +271,14 @@ export const ToolConfirmationMessage: React.FC<
bodyContentHeight -= 2; // Account for padding;
}
const commandBox = (
<Box>
<Text color={theme.text.link}>{executionProps.command}</Text>
</Box>
);
bodyContent = isAlternateBuffer ? (
commandBox
) : (
bodyContent = (
<MaxSizedBox
maxHeight={bodyContentHeight}
maxWidth={Math.max(terminalWidth, 1)}
>
{commandBox}
<Box>
<Text color={theme.text.link}>{executionProps.command}</Text>
</Box>
</MaxSizedBox>
);
} else if (confirmationDetails.type === 'info') {
@@ -338,7 +330,6 @@ export const ToolConfirmationMessage: React.FC<
isDiffingEnabled,
availableTerminalHeight,
terminalWidth,
isAlternateBuffer,
allowPermanentApproval,
]);