explain why using grapheme clustering is important
This commit is contained in:
parent
775feca02d
commit
ae44e758d6
1 changed files with 6 additions and 1 deletions
|
|
@ -68,11 +68,16 @@ class OverlayMessageTextState extends State<OverlayMessageText> {
|
|||
);
|
||||
}
|
||||
|
||||
// Convert the entire message into a list of characters
|
||||
// Convert the entire message into a list of characters
|
||||
final Characters messageCharacters =
|
||||
widget.pangeaMessageEvent.event.body.characters;
|
||||
|
||||
// When building token positions, use grapheme cluster indices
|
||||
// We use grapheme cluster indices to avoid splitting emojis and other
|
||||
// complex characters that requires multiple code units.
|
||||
// For instance, the emoji 🇺🇸 is represented by two code units:
|
||||
// - \u{1F1FA}
|
||||
// - \u{1F1F8}
|
||||
final List<TokenPosition> tokenPositions = [];
|
||||
int globalIndex = 0;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue