SIGN IN SIGN UP

fix(selection): snap endpoints to grapheme clusters

A drag or double-click endpoint was a single codepoint, so a selection could
split a ZWJ emoji sequence or separate a base letter from its combining mark,
and a click column walked ZWJ sequences as separate cells.

Cause: display-col->offset, selection-text-with, and highlight-selection-line
worked on codepoint offsets with no cluster awareness.

Fix: approximate grapheme clusters (zero-width codepoints and anything after a
ZWJ attach to the previous codepoint), map click columns per cluster, and snap
extraction and highlight ranges outward to cluster boundaries. Tests cover a
family emoji and e + U+0301.
H
Helge Sverre committed
075d69a84b8634b2ab9965081dc0f30e28ebc7ca
Parent: 2d90e76