explain why using grapheme clustering is important

pull/1476/head
WilsonLe 1 year ago
parent 775feca02d
commit ae44e758d6

@ -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…
Cancel
Save