public void EnterModeWithSelection(SnapshotSpan span, TextSelectionMode mode = TextSelectionMode.Stream) { _textView.SelectAndUpdateCaret(span, mode); Assert.IsFalse(_context.IsEmpty); _context.RunAll(); Assert.IsTrue(_context.IsEmpty); }
public static void SelectAndUpdateCaret(this ITextView textView, SnapshotSpan span, TextSelectionMode mode = TextSelectionMode.Stream) { textView.Selection.Mode = mode; textView.Selection.Select(span, false); MoveCaretTo(textView, span.End.Position); }
public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode, EnsureSpanVisibleOptions? scrollOptions) { throw new NotImplementedException(); }
public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode) { throw new NotImplementedException(); }
public void EnterMode(ModeKind kind, SnapshotSpan span, TextSelectionMode mode = TextSelectionMode.Stream) { EnterModeWithSelection(span, mode); _buffer.SwitchMode(kind, ModeArgument.None); }
public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode) => SelectAndMoveCaret(anchorPoint, activePoint, selectionMode, EnsureSpanVisibleOptions.MinimumScroll);
public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode, EnsureSpanVisibleOptions? scrollOptions) { anchorPoint = anchorPoint.TranslateTo(Snapshot); activePoint = activePoint.TranslateTo(Snapshot); if (anchorPoint == activePoint) Selection.Clear(); else Selection.Select(anchorPoint, activePoint); Selection.Mode = selectionMode; activePoint = activePoint.TranslateTo(Snapshot); Caret.MoveTo(activePoint); if (scrollOptions == null) return; anchorPoint = anchorPoint.TranslateTo(Snapshot); activePoint = activePoint.TranslateTo(Snapshot); if (activePoint > anchorPoint) ViewScroller.EnsureSpanVisible(new SnapshotSpan(anchorPoint.Position, activePoint.Position), scrollOptions.Value & ~EnsureSpanVisibleOptions.ShowStart); else ViewScroller.EnsureSpanVisible(new SnapshotSpan(activePoint.Position, anchorPoint.Position), scrollOptions.Value | EnsureSpanVisibleOptions.ShowStart); }
/// <summary> /// Sets text selection mode by words or chars /// </summary> /// <param name="mode">The parameter which indicates the text selection mode</param> /// <returns>An instance of the widget object</returns> public AnnotationWidget TextSelectionMode(TextSelectionMode mode) { _options.TextSelectionByCharModeEnabled = (mode == Options.TextSelectionMode.ByChars); return this; }
public void Clear() { Mode = TextSelectionMode.Stream; ClearInternal(); }
public TextSelection(IWpfTextView textView, IAdornmentLayer selectionLayer, IEditorFormatMap editorFormatMap) { if (textView == null) throw new ArgumentNullException(nameof(textView)); if (selectionLayer == null) throw new ArgumentNullException(nameof(selectionLayer)); if (editorFormatMap == null) throw new ArgumentNullException(nameof(editorFormatMap)); TextView = textView; Mode = TextSelectionMode.Stream; activePoint = anchorPoint = new VirtualSnapshotPoint(TextView.TextSnapshot, 0); TextView.TextBuffer.ChangedHighPriority += TextBuffer_ChangedHighPriority; TextView.Options.OptionChanged += Options_OptionChanged; TextView.GotAggregateFocus += TextView_GotAggregateFocus; TextView.LostAggregateFocus += TextView_LostAggregateFocus; textSelectionLayer = new TextSelectionLayer(this, selectionLayer, editorFormatMap); ActivationTracksFocus = true; }
public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode, EnsureSpanVisibleOptions? scrollOptions) => EditorOperations.SelectAndMoveCaret(anchorPoint, activePoint, selectionMode, scrollOptions);
public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode) => EditorOperations.SelectAndMoveCaret(anchorPoint, activePoint, selectionMode);