Skip to content

The all-in-one local AI studio for your desktop: chat, image and video generation and a coding agent in one free, open source app. Windows and Linux. No Docker, no terminal, no cloud required.

fix(chat): long words, URLs and hashes wrap inside the bubble

purple3dab6b314a5c
diff --git a/src/components/chat/MarkdownRenderer.tsx b/src/components/chat/MarkdownRenderer.tsx
index a34f426a..fe93f798 100644
--- a/src/components/chat/MarkdownRenderer.tsx
+++ b/src/components/chat/MarkdownRenderer.tsx
@@ -195,7 +195,9 @@ const components: Components = {
export function MarkdownRenderer({ content }: Props) {
const rehypePlugins = useRehypePlugins(content)
return (
- <div className="markdown-content text-gray-800 dark:text-gray-200">
+ // wrap-anywhere: a URL, hash or base64 run without a space used to run out
+ // of the bubble and get cut at the window edge (T1 night test 3.0.9, A5).
+ <div className="markdown-content text-gray-800 dark:text-gray-200 wrap-anywhere">
<ReactMarkdown remarkPlugins={[remarkGfm, [remarkMath, MATH_OPTIONS]]} rehypePlugins={rehypePlugins} components={components}>
{content}
</ReactMarkdown>
diff --git a/src/components/chat/MessageBubble.tsx b/src/components/chat/MessageBubble.tsx
index 47cc84cc..00c056b0 100644
--- a/src/components/chat/MessageBubble.tsx
+++ b/src/components/chat/MessageBubble.tsx
@@ -553,7 +553,7 @@ function MessageBubbleImpl({ message, onRegenerate, onRegenerateRound, onEdit, p
// long expanded instruction held in content (which drives the model).
// The same holds for a message with files: content carries their
// summaries for the model, the bubble shows what was typed.
- <p className="text-[0.78rem] leading-relaxed text-gray-800 dark:text-gray-200 whitespace-pre-wrap">{message.displayContent || message.content}</p>
+ <p className="text-[0.78rem] leading-relaxed text-gray-800 dark:text-gray-200 whitespace-pre-wrap wrap-anywhere">{message.displayContent || message.content}</p>
) : (
// Answer-blocks (when present) already rendered the per-iteration
// text chronologically above; skip message.content here to avoid
diff --git a/src/components/chat/__tests__/lange-woerter-brechen-in-der-blase-um.test.ts b/src/components/chat/__tests__/lange-woerter-brechen-in-der-blase-um.test.ts
new file mode 100644
index 00000000..8c9ee85a
--- /dev/null
+++ b/src/components/chat/__tests__/lange-woerter-brechen-in-der-blase-um.test.ts
@@ -0,0 +1,18 @@
+// T1 Nacht-Durchtest 3.0.9 (Jäger A, A5): eine URL, ein Hash oder Base64 ohne
+// Leerzeichen lief aus der Blase und wurde am Fensterrand abgeschnitten
+// (computed overflow-wrap: normal, scrollWidth 26 379 px bei 638 px Blase).
+// Beide Wege, die Text in eine Blase schreiben, tragen deshalb wrap-anywhere.
+import { readFileSync } from 'node:fs'
+import { resolve } from 'node:path'
+import { describe, expect, it } from 'vitest'
+
+const src = (f: string) => readFileSync(resolve(__dirname, '..', f), 'utf8')
+
+describe('a word without spaces in a chat bubble', () => {
+ it('wraps in the answer (markdown root)', () => {
+ expect(src('MarkdownRenderer.tsx')).toMatch(/className="markdown-content[^"]*\bwrap-anywhere\b/)
+ })
+ it('wraps in the user bubble', () => {
+ expect(src('MessageBubble.tsx')).toMatch(/whitespace-pre-wrap wrap-anywhere">\{message\.displayContent \|\| message\.content\}/)
+ })
+})