diff options
| author | Taylor Mullen <[email protected]> | 2025-05-15 22:56:03 -0700 |
|---|---|---|
| committer | N. Taylor Mullen <[email protected]> | 2025-05-15 22:57:28 -0700 |
| commit | 9c46acc793df3573e6fbcf53ac3e46663494e410 (patch) | |
| tree | 82c40d365c60f5e578a7548c65a15cb6e4838ccd /packages/cli/src/ui/components/messages/GeminiMessage.tsx | |
| parent | 33743d347b6721f8eec537d01ad9f6a95b4c6683 (diff) | |
Refactor: Improve UI rendering and address code review comments
This commit addresses several code review comments primarily focused on improving the rendering and stability of the CLI UI.
Key changes include:
- Passing `isPending` and `availableTerminalHeight` props to `MarkdownDisplay` to enable more intelligent rendering of content, especially for pending messages and code blocks.
- Adjusting height calculations in `ToolGroupMessage` and `ToolMessage` to more accurately reflect available space.
- Refining the logic in `App.tsx` for measuring and utilizing terminal height, including renaming `footerRef` to `mainControlsRef` for clarity.
- Ensuring consistent prop drilling for `isPending` and `availableTerminalHeight` through `HistoryItemDisplay`, `GeminiMessage`, and `GeminiMessageContent`.
- In `MarkdownDisplay`, when `isPending` is true and content exceeds `availableTerminalHeight`, the code block will now be truncated with a "... generating more ..." message. If there's insufficient space even for the
message, a simpler "... code is being written ..." will be shown.
Diffstat (limited to 'packages/cli/src/ui/components/messages/GeminiMessage.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/messages/GeminiMessage.tsx | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/cli/src/ui/components/messages/GeminiMessage.tsx b/packages/cli/src/ui/components/messages/GeminiMessage.tsx index b2c816a9..df8d0a87 100644 --- a/packages/cli/src/ui/components/messages/GeminiMessage.tsx +++ b/packages/cli/src/ui/components/messages/GeminiMessage.tsx @@ -11,9 +11,15 @@ import { Colors } from '../../colors.js'; interface GeminiMessageProps { text: string; + isPending: boolean; + availableTerminalHeight: number; } -export const GeminiMessage: React.FC<GeminiMessageProps> = ({ text }) => { +export const GeminiMessage: React.FC<GeminiMessageProps> = ({ + text, + isPending, + availableTerminalHeight, +}) => { const prefix = '✦ '; const prefixWidth = prefix.length; @@ -23,7 +29,11 @@ export const GeminiMessage: React.FC<GeminiMessageProps> = ({ text }) => { <Text color={Colors.AccentPurple}>{prefix}</Text> </Box> <Box flexGrow={1} flexDirection="column"> - <MarkdownDisplay text={text} /> + <MarkdownDisplay + text={text} + isPending={isPending} + availableTerminalHeight={availableTerminalHeight} + /> </Box> </Box> ); |
