AvalonStudio.TextEditor.TextEditor.DeleteSelection C# (CSharp) Method

DeleteSelection() private method

private DeleteSelection ( ) : bool
return bool
        private bool DeleteSelection()
        {
            var selectionStart = SelectionStart;
            var selectionEnd = SelectionEnd;

            if (selectionStart != selectionEnd)
            {
                var start = Math.Min(selectionStart, selectionEnd);
                var end = Math.Max(selectionStart, selectionEnd);
                TextDocument.Remove(start, end - start);
                TextView.Invalidate();

                SelectionStart = SelectionEnd = CaretIndex = start;

                return true;
            }
            return false;
        }