There are several ways to index into a String: UTF-8
byteindices (Rust uses these) or Unicode code points, which are encoding-independent. The
TextFieldprotocol uses the latter, and so this module has some helper functions to convert indices between these two representations. The legacy
TextInputStateuses UTF-16 code units as indices, so there are also functions that convert one of these
TextInputStates into one that uses UTF-8 byte indices instead, or vice-versa.