fix: truncate diff at 16 lines
This commit is contained in:
parent
63c9ecf24f
commit
cbb77e35ff
1 changed files with 9 additions and 1 deletions
|
|
@ -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>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
Loading…
Add table
Reference in a new issue