/// <inheritdoc/> protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e) { base.OnMouseLeftButtonDown(e); if (!e.Handled && TextView != null && TextArea != null) { e.Handled = true; TextArea.Focus(); SimpleSegment currentSeg = GetTextLineSegment(e); if (currentSeg == SimpleSegment.Invalid) { return; } TextArea.Caret.Offset = currentSeg.Offset + currentSeg.Length; if (CaptureMouse()) { selecting = true; selectionStart = new AnchorSegment(Document, currentSeg.Offset, currentSeg.Length); if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) { SimpleSelection simpleSelection = TextArea.Selection as SimpleSelection; if (simpleSelection != null) { selectionStart = new AnchorSegment(Document, simpleSelection); } } TextArea.Selection = new SimpleSelection(selectionStart); if ((Keyboard.Modifiers & ModifierKeys.Shift) == ModifierKeys.Shift) { ExtendSelection(currentSeg); } } } }
/// <inheritdoc/> public override bool Equals(object obj) { SimpleSelection other = obj as SimpleSelection; if (other == null) { return(false); } if (IsEmpty && other.IsEmpty) { return(true); } return(this.startOffset == other.startOffset && this.endOffset == other.endOffset); }