Merge pull request #3311 from pangeachat/3308-inconsistent-text-height-for-arabic-activity

chore: small token order fix
This commit is contained in:
ggurdin 2025-07-01 12:35:45 -04:00 committed by GitHub
commit b6865cda41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -204,12 +204,14 @@ class HtmlMessage extends StatelessWidget {
}
}
int position = 0;
for (final PangeaToken token in tokens ?? []) {
final String tokenText = token.text.content;
final substringIndex = result.indexWhere(
(string) =>
string.contains(tokenText) &&
!(string.startsWith('<') && string.endsWith('>')),
position,
);
if (substringIndex == -1) continue;
@ -229,6 +231,8 @@ class HtmlMessage extends StatelessWidget {
'<token offset="${token.text.offset}" length="${token.text.length}">$tokenText</token>',
if (after.isNotEmpty) after,
]);
position = substringIndex;
}
if (pangeaMessageEvent?.textDirection == TextDirection.rtl) {