chore: fix substring index issue with emoji characters (#3708)
This commit is contained in:
parent
c9494f69f1
commit
9016a41c9f
1 changed files with 6 additions and 1 deletions
|
|
@ -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…
Add table
Reference in a new issue