isWideGrapheme function

bool isWideGrapheme(
  1. String grapheme
)

Returns true if the given grapheme cluster is a double-width (wide) character.

Optimization Note - ASCII Fast-Path: Since the overwhelming majority of characters in typical TUI applications are standard ASCII (alphanumeric characters, punctuation, spaces), we check the first codeUnit. If it is < 128, we bypass the expensive grapheme cluster iterator/rune inspection and Unicode range checks entirely.

Implementation

bool isWideGrapheme(String grapheme) {
  if (grapheme.isEmpty) return false;
  return isWideCodePoint(grapheme.runes.first);
}