diff --git a/cli/src/components/thinking.tsx b/cli/src/components/thinking.tsx index 87731d48d..bc1ab10e0 100644 --- a/cli/src/components/thinking.tsx +++ b/cli/src/components/thinking.tsx @@ -39,7 +39,7 @@ export const Thinking = memo( } const width = Math.max(10, availableWidth ?? contentMaxWidth) - // Normalize content to single line for consistent preview + // Normalize content to single line for consistent preview (but preserve in expanded mode) const normalizedContent = content.replace(/\n+/g, ' ').trim() // Account for "..." prefix (3 chars) when calculating line widths const effectiveWidth = width - 3 @@ -48,6 +48,8 @@ export const Thinking = memo( effectiveWidth, PREVIEW_LINE_COUNT, ) + // In expanded mode, preserve original line breaks for proper markdown rendering + const expandedContent = content.replace(/\n\n+/g, '\n\n').trim() const showFull = thinkingCollapseState === 'expanded' const showPreview = thinkingCollapseState === 'preview' && lines.length > 0 @@ -94,7 +96,7 @@ export const Thinking = memo( }} attributes={TextAttributes.ITALIC} > - {content} + {expandedContent} )}