From bfcdd0164ca13e32b611c14cc3f17c10046396cb Mon Sep 17 00:00:00 2001 From: Rune Olsen Date: Tue, 14 Jul 2026 08:38:39 +0200 Subject: [PATCH] =?UTF-8?q?Fix=20assistant=20message=20text=20truncating?= =?UTF-8?q?=20with=20"=E2=80=A6"=20instead=20of=20wrapping?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two contributing layout issues in the chat message bubble: 1. MessageRow's content VStack (icon + text HStack) had no .frame(maxWidth: .infinity), so it sized to its content's ideal width instead of the space actually available. 2. swift-markdown-ui renders paragraphs with mixed inline styling (bold/italic runs next to plain text) as concatenated Text(+) segments, which on macOS report their ideal unwrapped single-line size for height purposes instead of wrapping — truncating with "…" regardless of window width. Plain single-style paragraphs (a single Text) weren't affected, which is why some lines wrapped fine and others didn't. Fixed by adding .frame(maxWidth: .infinity, alignment: .leading) to the MessageRow content stack, and .fixedSize(horizontal: false, vertical: true) to the markdown paragraph label so height is recomputed for the width actually given instead of the ideal width. Co-Authored-By: Claude Sonnet 5 --- oAI/Views/Main/MarkdownContentView.swift | 7 +++++++ oAI/Views/Main/MessageRow.swift | 1 + 2 files changed, 8 insertions(+) diff --git a/oAI/Views/Main/MarkdownContentView.swift b/oAI/Views/Main/MarkdownContentView.swift index 4772519..7c60873 100644 --- a/oAI/Views/Main/MarkdownContentView.swift +++ b/oAI/Views/Main/MarkdownContentView.swift @@ -61,8 +61,15 @@ struct MarkdownContentView: View { .markdownBlockStyle(\.paragraph) { configuration in configuration.label .markdownMargin(top: 0, bottom: 8) + // MarkdownUI builds mixed-style paragraphs (bold/italic runs alongside + // plain text) as concatenated Text(+) segments, which on macOS report + // their ideal (unwrapped, single-line) size instead of wrapping to the + // width actually available — truncating with "…" mid-word. Forcing the + // height to be recomputed for the given (flexible) width fixes it. + .fixedSize(horizontal: false, vertical: true) } .textSelection(.enabled) + .frame(maxWidth: .infinity, alignment: .leading) } // MARK: - Parsing diff --git a/oAI/Views/Main/MessageRow.swift b/oAI/Views/Main/MessageRow.swift index 16f554c..ee42c0c 100644 --- a/oAI/Views/Main/MessageRow.swift +++ b/oAI/Views/Main/MessageRow.swift @@ -185,6 +185,7 @@ struct MessageRow: View { .foregroundColor(.oaiSecondary) } } + .frame(maxWidth: .infinity, alignment: .leading) } .padding(16) .background(Color.messageBackground(for: message.role))