From 6df46c73a153c940d77c1fa41ace24ee687fb507 Mon Sep 17 00:00:00 2001 From: ggurdin <46800240+ggurdin@users.noreply.github.com> Date: Wed, 12 Mar 2025 12:08:57 -0400 Subject: [PATCH] chore: fix newline rendering in non-HTML formatted messages (#2131) --- lib/pangea/toolbar/widgets/message_token_text.dart | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lib/pangea/toolbar/widgets/message_token_text.dart b/lib/pangea/toolbar/widgets/message_token_text.dart index 0a9f66702..4777b0fc6 100644 --- a/lib/pangea/toolbar/widgets/message_token_text.dart +++ b/lib/pangea/toolbar/widgets/message_token_text.dart @@ -234,6 +234,10 @@ class MessageTextWidget extends StatelessWidget { } } + if (tokenPosition.token?.pos == 'SPACE') { + return const TextSpan(text: '\n'); + } + if (tokenPosition.token != null) { // if the tokenPosition is a combination of the token and preceding / following punctuation // split them so that only the token itself is highlighted when clicked @@ -280,7 +284,10 @@ class MessageTextWidget extends StatelessWidget { onTap: onClick != null ? () => onClick?.call(tokenPosition) : null, - child: HiddenText(text: middle, style: style), + child: HiddenText( + text: middle, + style: style, + ), ), ) : LinkifySpan(