fix: add line breaks in quota/capacity msgs (#12603)

This commit is contained in:
Adam Weidman
2025-11-05 16:12:06 -05:00
committed by GitHub
parent fa93b56243
commit c951f9fdcd
4 changed files with 62 additions and 26 deletions

View File

@@ -55,6 +55,18 @@ describe('<HistoryItemDisplay />', () => {
expect(lastFrame()).toContain('/theme');
});
it('renders InfoMessage for "info" type with multi-line text', () => {
const item: HistoryItem = {
...baseItem,
type: MessageType.INFO,
text: '⚡ Line 1\n⚡ Line 2\n⚡ Line 3',
};
const { lastFrame } = renderWithProviders(
<HistoryItemDisplay {...baseItem} item={item} />,
);
expect(lastFrame()).toMatchSnapshot();
});
it('renders StatsDisplay for "stats" type', () => {
const item: HistoryItem = {
...baseItem,

View File

@@ -1,5 +1,12 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
exports[`<HistoryItemDisplay /> > renders InfoMessage for "info" type with multi-line text 1`] = `
"
⚡ Line 1
⚡ Line 2
⚡ Line 3"
`;
exports[`<HistoryItemDisplay /> > should render a full gemini item when using availableTerminalHeightGemini 1`] = `
"✦ Example code block:
1 Line 1

View File

@@ -22,10 +22,12 @@ export const InfoMessage: React.FC<InfoMessageProps> = ({ text }) => {
<Box width={prefixWidth}>
<Text color={theme.status.warning}>{prefix}</Text>
</Box>
<Box flexGrow={1}>
<Text wrap="wrap">
<RenderInline text={text} defaultColor={theme.status.warning} />
</Text>
<Box flexGrow={1} flexDirection="column">
{text.split('\n').map((line, index) => (
<Text wrap="wrap" key={index}>
<RenderInline text={line} defaultColor={theme.status.warning} />
</Text>
))}
</Box>
</Box>
);