mirror of
https://github.com/odin-lang/Odin.git
synced 2026-08-14 01:34:35 +00:00
`decode_grapheme_iterate` already computed the text of each grapheme cluster, but `decode_grapheme_clusters` discarded it, forcing callers to reconstruct each cluster's range by looking ahead to the next grapheme's `byte_index`. Store it on `Grapheme` instead; it is a slice of the input string, so no allocation is involved. `core:text/edit` was using `Grapheme.width` -- the number of monospace cells -- as a byte count when moving the caret by grapheme, so it landed in the middle of a cluster for anything wider than one byte per cell. Use `len(Grapheme.text)`, and add a test package for the translations. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>