fix: truncate diff at 16 lines

This commit is contained in:
Nate 2025-07-14 00:59:26 -07:00
parent 63c9ecf24f
commit cbb77e35ff

View file

@ -78,9 +78,12 @@ export const ColoredDiff: React.FC<{ diffContent: string }> = ({ diffContent })
(l) => l.type !== 'hunk' && l.type !== 'other', (l) => l.type !== 'hunk' && l.type !== 'other',
); );
const truncatedLines = displayableLines.slice(0, 16);
const isTruncated = displayableLines.length > 16;
return ( return (
<Box flexDirection="column"> <Box flexDirection="column">
{displayableLines.map((line, index) => { {truncatedLines.map((line, index) => {
const lineKey = `diff-line-${index}`; const lineKey = `diff-line-${index}`;
let gutterNumStr = ''; let gutterNumStr = '';
let prefixSymbol = ' '; let prefixSymbol = ' ';
@ -119,6 +122,11 @@ export const ColoredDiff: React.FC<{ diffContent: string }> = ({ diffContent })
</Box> </Box>
); );
})} })}
{isTruncated && (
<Text color="gray" dimColor>
... ({displayableLines.length - 16} more lines)
</Text>
)}
</Box> </Box>
); );
}; };