w3c / selection-api

Selection API
http://w3c.github.io/selection-api/
Other
47 stars 30 forks source link

Need a way to get combining character status from Range or offset #31

Open BenjamP opened 9 years ago

BenjamP commented 9 years ago

If given a range, can we return if the character there is combined or simple? This helps with knowing how to correctly control selection movement. -From MS Office Team

kojiishi commented 9 years ago

There are a lots of ways to define "a combined character."

Since it's said for selections, I guess it's about extended grapheme cluster boundaries as defined in UAX#29 or CSS typographic character unit. Since both could be up to several length, do you expect to get a range of a single unit given a range or offset?

NorbertLindenberg commented 9 years ago

I think a typical API would take an offset and return the offset of the previous or next cluster boundary. And you'd want that separately for selection and deletion because in some cases different cluster definitions are used for these two purposes. E.g., Devanagari हि, at least on Mac, is one unit for selection, but two for deletion.