mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-03-10 22:21:22 -07:00
Updated tool heights to be compatible with changes
This commit is contained in:
@@ -191,7 +191,7 @@ export const ToolGroupMessage: React.FC<ToolGroupMessageProps> = ({
|
||||
maxLinesLimit: maxLines,
|
||||
});
|
||||
|
||||
if (!contentMaxLines) return false;
|
||||
if (contentMaxLines === undefined) return false;
|
||||
|
||||
if (typeof tool.resultDisplay === 'string') {
|
||||
const text = tool.resultDisplay;
|
||||
|
||||
@@ -23,7 +23,10 @@ import { Scrollable } from '../shared/Scrollable.js';
|
||||
import { ScrollableList } from '../shared/ScrollableList.js';
|
||||
import { SCROLL_TO_ITEM_END } from '../shared/VirtualizedList.js';
|
||||
import { ACTIVE_SHELL_MAX_LINES } from '../../constants.js';
|
||||
import { calculateToolContentMaxLines } from '../../utils/toolLayoutUtils.js';
|
||||
import {
|
||||
calculateToolContentMaxLines,
|
||||
TOOL_RESULT_MIN_LINES_SHOWN,
|
||||
} from '../../utils/toolLayoutUtils.js';
|
||||
import { SubagentProgressDisplay } from './SubagentProgressDisplay.js';
|
||||
|
||||
// Large threshold to ensure we don't cause performance issues for very large
|
||||
@@ -61,6 +64,11 @@ export const ToolResultDisplay: React.FC<ToolResultDisplayProps> = ({
|
||||
maxLinesLimit: maxLines,
|
||||
});
|
||||
|
||||
const effectiveMaxHeight =
|
||||
availableHeight !== undefined
|
||||
? Math.max(TOOL_RESULT_MIN_LINES_SHOWN, availableHeight)
|
||||
: undefined;
|
||||
|
||||
const combinedPaddingAndBorderWidth = 4;
|
||||
const childWidth = terminalWidth - combinedPaddingAndBorderWidth;
|
||||
|
||||
@@ -132,7 +140,7 @@ export const ToolResultDisplay: React.FC<ToolResultDisplayProps> = ({
|
||||
if (isAlternateBuffer && Array.isArray(truncatedResultDisplay)) {
|
||||
// If availableHeight is undefined, fallback to a safe default to prevents infinite loop
|
||||
// where Container grows -> List renders more -> Container grows.
|
||||
const limit = maxLines ?? availableHeight ?? ACTIVE_SHELL_MAX_LINES;
|
||||
const limit = maxLines ?? effectiveMaxHeight ?? ACTIVE_SHELL_MAX_LINES;
|
||||
const listHeight = Math.min(
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
(truncatedResultDisplay as AnsiOutput).length,
|
||||
@@ -205,7 +213,7 @@ export const ToolResultDisplay: React.FC<ToolResultDisplayProps> = ({
|
||||
diffContent={(truncatedResultDisplay as FileDiffResult).fileDiff}
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
filename={(truncatedResultDisplay as FileDiffResult).fileName}
|
||||
availableTerminalHeight={availableHeight}
|
||||
availableTerminalHeight={effectiveMaxHeight}
|
||||
terminalWidth={childWidth}
|
||||
/>
|
||||
);
|
||||
@@ -219,7 +227,7 @@ export const ToolResultDisplay: React.FC<ToolResultDisplayProps> = ({
|
||||
// eslint-disable-next-line @typescript-eslint/no-unsafe-type-assertion
|
||||
data={truncatedResultDisplay as AnsiOutput}
|
||||
availableTerminalHeight={
|
||||
isAlternateBuffer ? undefined : availableHeight
|
||||
isAlternateBuffer ? undefined : effectiveMaxHeight
|
||||
}
|
||||
width={childWidth}
|
||||
maxLines={isAlternateBuffer ? undefined : maxLines}
|
||||
@@ -233,7 +241,7 @@ export const ToolResultDisplay: React.FC<ToolResultDisplayProps> = ({
|
||||
return (
|
||||
<Scrollable
|
||||
width={childWidth}
|
||||
maxHeight={maxLines ?? availableHeight}
|
||||
maxHeight={maxLines ?? effectiveMaxHeight}
|
||||
hasFocus={hasFocus} // Allow scrolling via keyboard (Shift+Up/Down)
|
||||
scrollToBottom={true}
|
||||
>
|
||||
@@ -245,7 +253,7 @@ export const ToolResultDisplay: React.FC<ToolResultDisplayProps> = ({
|
||||
return (
|
||||
<Box width={childWidth} flexDirection="column">
|
||||
<MaxSizedBox
|
||||
maxHeight={availableHeight}
|
||||
maxHeight={effectiveMaxHeight}
|
||||
maxWidth={childWidth}
|
||||
additionalHiddenLinesCount={hiddenLinesCount}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user