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