The unit an operation's offsets are counted in.
An editor describes its edit with the numbers its own strings give it:
at and remove from JavaScript's length and slice, which count
UTF-16 code units. String.length/1 counts graphemes, and the two agree
only while the text has nothing outside the Basic Multilingual Plane and
no combining marks — one emoji, and every offset after it is off by one for
the room, which then refuses or misplaces every edit. So the room measures
and cuts the document in the editor's unit.
Summary
Functions
Length in UTF-16 code units.
Replaces remove code units at at with insert.
The text as big-endian UTF-16, two bytes per code unit.
Functions
@spec length(String.t()) :: non_neg_integer()
Length in UTF-16 code units.
Replaces remove code units at at with insert.
:error when the splice points outside the text or would cut a surrogate
pair in half — neither can be applied without scattering characters.
The text as big-endian UTF-16, two bytes per code unit.