public bool IsValidPosition(HexBufferPoint position) {
if (position.Buffer != Buffer)
return false;
// Allow the last position since it's so easy to accidentally pass in the end position.
// The text editor API also allows this so to make everything easier, also allow it here,
// but treat it as Max(StartPosition, EndPosition - 1) (treating them as signed integers)
return BufferStart <= position && position <= BufferEnd;
}