private int LocalSelectionIndex(ITextComponentWrapper text)
 {
     // selection index could be out of bounds.
     return(Mathf.Clamp(Caret.GetSelectionIndex() - _drawStart, 0, text.DisplayedTextLength));
 }