mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-08-09 00:16:57 -07:00
09a6667c35
- Refined height calculation logic in ToolGroupMessage to ensure consistent spacing between compact and standard tools. - Adjusted padding and margins in StickyHeader, ToolConfirmationQueue, ShellToolMessage, and ToolMessage for visual alignment. - Updated TOOL_RESULT_STANDARD_RESERVED_LINE_COUNT to account for internal layout changes. - Improved ToolResultDisplay height handling in alternate buffer mode. - Updated test snapshots to reflect layout and spacing corrections. refactor(cli): cleanup and simplify UI components - Reduced UI refresh delay in AppContainer.tsx for a more responsive user experience. - Reorder imports and hook definitions within AppContainer.tsx to reduce diff 'noise'. refactor(cli): enhance compact output robustness and visual regression testing Addressing automated review feedback to improve code maintainability and layout stability. 1. Robust File Extension Parsing: - Introduced getFileExtension utility in packages/cli/src/ui/utils/fileUtils.ts using node:path for reliable extension extraction. - Updated DenseToolMessage and DiffRenderer to use the new utility, replacing fragile string splitting. 2. Visual Regression Coverage: - Added SVG snapshot tests to DenseToolMessage.test.tsx to verify semantic color rendering and layout integrity in compact mode. fix(cli): resolve dense tool output code quality issues - Replaced manual string truncation with Ink's `wrap="truncate-end"` to adhere to UI guidelines. - Added `isReadManyFilesResult` type guard to `packages/core/src/tools/tools.ts` to improve typing for structured tool results. - Fixed an incomplete test case in `DenseToolMessage.test.tsx` to properly simulate expansion via context instead of missing mouse events.
76 lines
1.6 KiB
TypeScript
76 lines
1.6 KiB
TypeScript
/**
|
|
* @license
|
|
* Copyright 2025 Google LLC
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
import type React from 'react';
|
|
import { Box, type DOMElement } from 'ink';
|
|
import { theme } from '../semantic-colors.js';
|
|
|
|
export interface StickyHeaderProps {
|
|
children: React.ReactNode;
|
|
width: number;
|
|
isFirst: boolean;
|
|
borderColor: string;
|
|
borderDimColor: boolean;
|
|
containerRef?: React.RefObject<DOMElement | null>;
|
|
}
|
|
|
|
export const StickyHeader: React.FC<StickyHeaderProps> = ({
|
|
children,
|
|
width,
|
|
isFirst,
|
|
borderColor,
|
|
borderDimColor,
|
|
containerRef,
|
|
}) => (
|
|
<Box
|
|
ref={containerRef}
|
|
sticky
|
|
minHeight={1}
|
|
flexShrink={0}
|
|
width={width}
|
|
stickyChildren={
|
|
<Box
|
|
borderStyle="round"
|
|
flexDirection="column"
|
|
width={width}
|
|
opaque
|
|
borderColor={borderColor}
|
|
borderDimColor={borderDimColor}
|
|
borderBottom={false}
|
|
borderTop={isFirst}
|
|
paddingTop={isFirst ? 0 : 1}
|
|
>
|
|
<Box paddingX={1}>{children}</Box>
|
|
{/* Dark border to separate header from content. */}
|
|
<Box
|
|
width={width - 2}
|
|
borderColor={theme.ui.dark}
|
|
borderStyle="single"
|
|
borderTop={false}
|
|
borderBottom={true}
|
|
borderLeft={false}
|
|
borderRight={false}
|
|
></Box>
|
|
</Box>
|
|
}
|
|
>
|
|
<Box
|
|
borderStyle="round"
|
|
width={width}
|
|
borderColor={borderColor}
|
|
borderDimColor={borderDimColor}
|
|
borderBottom={false}
|
|
borderTop={isFirst}
|
|
borderLeft={true}
|
|
borderRight={true}
|
|
paddingX={1}
|
|
paddingTop={isFirst ? 0 : 1}
|
|
>
|
|
{children}
|
|
</Box>
|
|
</Box>
|
|
);
|