Expand description
Graph positions to edit-plan positions.
These are two different coordinate systems and nothing warns you when they are confused: the graph records a 1-based byte column, the edit plan carries a 0-based UTF-16 character offset. They agree on every ASCII line, which is exactly why a mix-up survives testing and then corrupts the first file with an accented name or an emoji in a comment.
Every conversion here refuses rather than clamps. A column past the end of its line means the graph no longer describes the file, and silently landing an edit at the nearest valid offset would write bytes nobody planned.
Enums§
- Position
Error - A position that could not be converted, with the reason an agent can act on.
Functions§
- slice_
between - The exact text between two graph positions, or
Nonewhen either does not convert. - utf16_
line_ length - The UTF-16 length of a whole line, for an edit that ends where the line does.
- utf16_
offset - The 0-based UTF-16 offset of a 1-based byte column on a 1-based line.