~emersion/goguma-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH] Fix regression in compact message formatting

Details
Message ID
<20221216212612.29967-1-delthas@dille.cc>
DKIM signature
pass
Download raw message
Patch: +5 -3
A recent commit [1] broke mesage formatting in compact message mode.

Linkify was stripping all formatting, and the style was never passed
back before displaying it.

We cannot just rely on a DefaultStyle here because there are multiple
styles we want to apply, one per formatting span found in the IRC
message formatting.

Instead, this patch adds back the text style parameter to linkify, but
making it optional.

[1]: 6c7c51b029c9be8664c958279f632313bac5f193
---
 lib/linkify.dart     | 3 ++-
 lib/page/buffer.dart | 5 +++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/linkify.dart b/lib/linkify.dart
index 1d0b18a..5b5e13f 100644
--- a/lib/linkify.dart
+++ b/lib/linkify.dart
@@ -20,7 +20,7 @@ List<LinkifyElement> extractLinks(String text, [NetworkModel? network]) {
}

TextSpan linkify(BuildContext context, String text, {
	required TextStyle linkStyle,
	required TextStyle linkStyle, TextStyle? textStyle
}) {
	NetworkModel? network;
	try {
@@ -43,6 +43,7 @@ TextSpan linkify(BuildContext context, String text, {
				throw Exception('Failed to launch URL: ${link.url}');
			}
		},
		style: textStyle,
		linkStyle: linkStyle,
	);
}
diff --git a/lib/page/buffer.dart b/lib/page/buffer.dart
index 80641ed..a8fc1c3 100644
--- a/lib/page/buffer.dart
+++ b/lib/page/buffer.dart
@@ -428,7 +428,7 @@ class _CompactMessageItem extends StatelessWidget {
		var textStyle = TextStyle(color: Theme.of(context).textTheme.bodyText1!.color);

		List<TextSpan> textSpans;
		if (ctcp != null && ctcp.cmd == 'ACTION') {
		if (ctcp != null) {
			textStyle = textStyle.apply(fontStyle: FontStyle.italic);

			if (ctcp.cmd == 'ACTION') {
@@ -441,7 +441,8 @@ class _CompactMessageItem extends StatelessWidget {
		}

		textSpans = textSpans.map((span) {
			return linkify(context, span.text!, linkStyle: TextStyle(decoration: TextDecoration.underline));
			var linkStyle = span.style!.apply(decoration: TextDecoration.underline);
			return linkify(context, span.text!, textStyle: span.style!, linkStyle: linkStyle);
		}).toList();

		List<Widget> stack = [];

base-commit: c4df7fe91caae2ba0f4d3af0df8fb62757556790
-- 
2.17.1
Details
Message ID
<ZhASPI5yJwLzkxRX1Gr1g09AUDSR4o_WWCRXitb9487v1Q3IkzYVYrhAdsWZAkZLxgZ9vrO33syYyFnh-kuZlS8m0HzmA9cBzZ1ws1hftYY=@emersion.fr>
In-Reply-To
<20221216212612.29967-1-delthas@dille.cc> (view parent)
DKIM signature
pass
Download raw message
NACK, this shouldn't be needed. We should be able to apply a
DefaultTextStyle to the container instead.
Reply to thread Export thread (mbox)