Skip to content

Commit

Permalink
fix: wrap MFM with bidirectional isolate (#520)
Browse files Browse the repository at this point in the history
  • Loading branch information
poppingmoon authored Jan 16, 2025
1 parent bcbd921 commit 4bb341d
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions lib/view/widget/mfm.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1155,24 +1155,20 @@ class _Mfm extends StatelessWidget {

@override
Widget build(BuildContext context) {
final needsIsolate =
builder != null || (trailingSpans?.isNotEmpty ?? false);
final span = TextSpan(
children: [
...?leadingSpans,
if (needsIsolate) const TextSpan(text: Unicode.FSI),
if (nodes case final nodes?) ..._buildNodes(context, config, nodes),
if (trailingSpans case final spans? when spans.isNotEmpty) ...[
const TextSpan(text: Unicode.PDF),
...spans,
],
if (needsIsolate) const TextSpan(text: Unicode.PDI),
...?trailingSpans,
],
);

if (builder case final builder?) {
return builder(
context,
TextSpan(
children: [span, const TextSpan(text: Unicode.PDF)],
),
);
return builder(context, span);
} else {
return Text.rich(
span,
Expand Down

0 comments on commit 4bb341d

Please sign in to comment.