public override void MoveToNextCharacter(bool extendSelection) { VirtualSnapshotPoint oldCaretPoint = this.AdvancedCaret.Position.VirtualBufferPosition; TextPoint endPoint = TextView.Selection.GetEndPoint(); bool selectionIsEmpty = TextView.Selection.IsEmpty; if (!extendSelection) { TextView.AdvancedTextView.Selection.Clear(); } // If the selection is not empty, VS clears the selection and sets // the caret at the end of the selection (regardless of it were reversed or not) if (!extendSelection && !selectionIsEmpty) { MoveTo(endPoint.CurrentPosition); } else { AdvancedCaret.MoveToNextCaretPosition(); } AdvancedCaret.EnsureVisible(); UpdateSelection(extendSelection, oldCaretPoint); }