Skip to content

Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.

fix(chat): render single line breaks and quotes as Claude Code does

Paul Robertson63ec77c11680
diff --git a/src/renderer/nodes/ChatPanel.thread.test.tsx b/src/renderer/nodes/ChatPanel.thread.test.tsx
index 643d344f8..1cb5fe518 100644
--- a/src/renderer/nodes/ChatPanel.thread.test.tsx
+++ b/src/renderer/nodes/ChatPanel.thread.test.tsx
@@ -84,6 +84,19 @@ describe('⌘M thread look', () => {
expect(assistant.querySelector('.term-chat__text strong')?.textContent).toBe('now')
})
+ it('keeps single line breaks, as Claude Code renders them — in prompts and in quoted replies', async () => {
+ await mount([
+ { role: 'user', parts: [{ kind: 'text', text: 'This is a test\nof a multiline message' }], key: 0 },
+ { role: 'assistant', parts: [{ kind: 'text', text: '> This is a test\n> of a multiline message' }], key: 10 }
+ ])
+
+ const user = host.querySelector('.term-chat__msg--user .term-chat__text')!
+ const quote = host.querySelector('.term-chat__msg--assistant .term-chat__text blockquote')!
+
+ expect(user.querySelector('br')).not.toBeNull()
+ expect(quote.querySelector('br')).not.toBeNull()
+ })
+
it('one action row per assistant TURN (not per tool line), the latest always shown', async () => {
await mount(thread)
const rows = [...host.querySelectorAll('.term-chat__actions')]
diff --git a/src/renderer/nodes/ChatPanel.tsx b/src/renderer/nodes/ChatPanel.tsx
index cbe4247f0..37e95ad3b 100644
--- a/src/renderer/nodes/ChatPanel.tsx
+++ b/src/renderer/nodes/ChatPanel.tsx
@@ -36,8 +36,10 @@ import { assistantTurnEnds } from '../lib/chatThread'
// Memoized bubble: marked+DOMPurify re-ran for EVERY message on each ChatPanel render (each
// turn-finish reload, each keystroke re-render). Text is stable per message, so cache per text.
+// `breaks`: a single newline is a line break, as Claude Code's own TUI renders it — without it a
+// multi-line prompt, or a reply quoting one line by line (`> a` / `> b`), collapsed onto one line.
export const MarkdownText = memo(function MarkdownText({ text }: { text: string }) {
- const html = useMemo(() => renderMarkdown(text), [text])
+ const html = useMemo(() => renderMarkdown(text, { breaks: true }), [text])
return <div className="term-chat__text" dangerouslySetInnerHTML={{ __html: html }} />
})
diff --git a/src/renderer/styles.css b/src/renderer/styles.css
index cb660db8b..eab592504 100644
--- a/src/renderer/styles.css
+++ b/src/renderer/styles.css
@@ -3407,6 +3407,14 @@ body,
text-decoration: underline;
text-underline-offset: 2px;
}
+/* Same treatment as the markdown view's quotes (.term-md__content blockquote); without it a quote
+ in the thread was only the browser's default indent. */
+.term-chat__text blockquote {
+ margin: 6px 0;
+ padding-left: 10px;
+ border-left: 3px solid var(--border);
+ color: var(--muted);
+}
/* A tool call in the unbubbled assistant flow: a quiet chip on the panel itself (a light tint and a
hairline), not a dark box nested in a bubble that is no longer there. */
.term-chat__tool {