From a9a518c6c18229acbdeac4bbcc66e87772273dd9 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Fri, 26 Jan 2024 11:25:29 -0500 Subject: [PATCH] Fix trailing whitespace not being stripped from compose reply content --- Tusker/Screens/Compose/ComposeReplyContentView.swift | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/Tusker/Screens/Compose/ComposeReplyContentView.swift b/Tusker/Screens/Compose/ComposeReplyContentView.swift index d7c458a1..9a37ee70 100644 --- a/Tusker/Screens/Compose/ComposeReplyContentView.swift +++ b/Tusker/Screens/Compose/ComposeReplyContentView.swift @@ -28,8 +28,13 @@ struct ComposeReplyContentView: UIViewRepresentable { view.adjustsFontForContentSizeCategory = true view.overrideMastodonController = mastodonController - view.attributedText = TimelineStatusCollectionViewCell.htmlConverter.convert(status.content) - + let content = TimelineStatusCollectionViewCell.htmlConverter.convert(status.content) + let collapsedContent = NSMutableAttributedString(attributedString: content) + collapsedContent.collapseWhitespace() + collapsedContent.trimLeadingCharactersInSet(.whitespacesAndNewlines) + collapsedContent.trimTrailingCharactersInSet(.whitespacesAndNewlines) + view.attributedText = collapsedContent + return view }