chore: fix substring index issue with emoji characters (#3708)

pull/2245/head
ggurdin 3 months ago committed by GitHub
parent c9494f69f1
commit 9016a41c9f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -219,9 +219,14 @@ class HtmlMessage extends StatelessWidget {
);
if (substringIndex == -1) continue;
final int tokenIndex = result[substringIndex].indexOf(tokenText);
int tokenIndex = result[substringIndex].indexOf(tokenText);
if (tokenIndex == -1) continue;
final beforeSubstring = result[substringIndex].substring(0, tokenIndex);
if (beforeSubstring.length != beforeSubstring.characters.length) {
tokenIndex = beforeSubstring.characters.length;
}
final int tokenLength = tokenText.characters.length;
final before =
result[substringIndex].characters.take(tokenIndex).toString();

Loading…
Cancel
Save