diff options
| author | Taylor Mullen <[email protected]> | 2025-04-25 17:11:08 -0700 |
|---|---|---|
| committer | N. Taylor Mullen <[email protected]> | 2025-04-26 16:08:05 -0700 |
| commit | 5be89befeff9c4d4f3ab9f508f030bc153fdd06b (patch) | |
| tree | 9d4f679a0e7292132cab04fdd3c24062fcd66ce8 /packages/cli/src/ui/components/messages/DiffRenderer.tsx | |
| parent | aa65a4a1fc3f51589c7633217f9d3c8bd0141abb (diff) | |
feat: Fix flickering in iTerm + scrolling + performance issues.
- Refactors history display using Ink's <Static> component to prevent flickering and improve performance by rendering completed items statically.
- Introduces ConsolePatcher component to capture and display console.log, console.warn, and console.error output within the Ink UI, addressing native handling issues.
- Introduce a new content splitting mechanism to work better for static items. Basically when content gets too long we will now split content into multiple blocks for Gemini messages to ensure that we can statically cache larger pieces of history.
Fixes:
- https://b.corp.google.com/issues/411450097
- https://b.corp.google.com/issues/412716309
Diffstat (limited to 'packages/cli/src/ui/components/messages/DiffRenderer.tsx')
| -rw-r--r-- | packages/cli/src/ui/components/messages/DiffRenderer.tsx | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/packages/cli/src/ui/components/messages/DiffRenderer.tsx b/packages/cli/src/ui/components/messages/DiffRenderer.tsx index eb3133c3..4d196e6d 100644 --- a/packages/cli/src/ui/components/messages/DiffRenderer.tsx +++ b/packages/cli/src/ui/components/messages/DiffRenderer.tsx @@ -7,6 +7,7 @@ import React from 'react'; import { Box, Text } from 'ink'; import { Colors } from '../../colors.js'; +import crypto from 'crypto'; interface DiffLine { type: 'add' | 'del' | 'context' | 'hunk' | 'other'; @@ -94,6 +95,7 @@ const DEFAULT_TAB_WIDTH = 4; // Spaces per tab for normalization export const DiffRenderer: React.FC<DiffRendererProps> = ({ diffContent, + filename, tabWidth = DEFAULT_TAB_WIDTH, }) => { if (!diffContent || typeof diffContent !== 'string') { @@ -137,8 +139,11 @@ export const DiffRenderer: React.FC<DiffRendererProps> = ({ } // --- End Modification --- + const key = filename + ? `diff-box-${filename}` + : `diff-box-${crypto.createHash('sha1').update(diffContent).digest('hex')}`; return ( - <Box flexDirection="column"> + <Box flexDirection="column" key={key}> {/* Iterate over the lines that should be displayed (already normalized) */} {displayableLines.map((line, index) => { const key = `diff-line-${index}`; |
