public void ExtendSelectionTo (long offset) { offset = System.Math.Min (Length, System.Math.Max (0, offset)); if (MainSelection == null) MainSelection = new Selection (offset, offset); MainSelection.Lead = offset; }
public void SetSelection (long anchor, long lead) { anchor = System.Math.Min (Length, System.Math.Max (0, anchor)); lead = System.Math.Min (Length, System.Math.Max (0, lead)); MainSelection = new Selection (anchor, lead); }
public void DeleteSelection () { if (!this.IsSomethingSelected) return; long start = MainSelection.Segment.Offset; switch (MainSelection.SelectionMode) { case SelectionMode.Normal: Remove (MainSelection.Segment); break; case SelectionMode.Block: throw new NotImplementedException (); } MainSelection = null; Caret.Offset = start; OnSelectionChanged (EventArgs.Empty); }
public void ClearSelection () { if (!this.IsSomethingSelected) return; MainSelection = null; OnSelectionChanged (EventArgs.Empty); }