private void SetSelectionStart(int index, ByInterface method, int textColumnIndex) { this.EnsureSelectionArrays(textColumnIndex); if (index == this.SelectionStart) { return; } if (method == ByInterface.Manually || method == ByInterface.ByMouse) { // We are moving to another location in the text, and hence we should make sure that text styles are checked for // in a delayed manner and not on each keystroke (like spellchecking). // They are now found and/or updated before moving away. TextDocument.FakeFinalizingKey(this._selectionStart[textColumnIndex], textColumnIndex); } this._selectionStart[textColumnIndex] = Math.Max(0, Math.Min(TextLength, index)); this._textSegmentSelection[textColumnIndex].Index = this._selectionStart[textColumnIndex]; this.UpdateCaretLocation(); this.Caret.ResetBlink(); if (this.SelectionChanged != null) { this.SelectionChanged(this, new SelectionChangedArgs(method, textColumnIndex)); } }