Example #1
0
 public void EnterModeWithSelection(SnapshotSpan span, TextSelectionMode mode = TextSelectionMode.Stream)
 {
     _textView.SelectAndUpdateCaret(span, mode);
     Assert.IsFalse(_context.IsEmpty);
     _context.RunAll();
     Assert.IsTrue(_context.IsEmpty);
 }
Example #2
0
 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);
 }
Example #3
0
 public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode, EnsureSpanVisibleOptions? scrollOptions) {
     throw new NotImplementedException();
 }
Example #4
0
 public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode) {
     throw new NotImplementedException();
 }
Example #5
0
 public void EnterMode(ModeKind kind, SnapshotSpan span, TextSelectionMode mode = TextSelectionMode.Stream)
 {
     EnterModeWithSelection(span, mode);
     _buffer.SwitchMode(kind, ModeArgument.None);
 }
Example #6
0
		public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode) =>
			SelectAndMoveCaret(anchorPoint, activePoint, selectionMode, EnsureSpanVisibleOptions.MinimumScroll);
Example #7
0
		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;
 }
Example #9
0
		public void Clear() {
			Mode = TextSelectionMode.Stream;
			ClearInternal();
		}
Example #10
0
		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;
		}
Example #11
0
		public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode, EnsureSpanVisibleOptions? scrollOptions) => EditorOperations.SelectAndMoveCaret(anchorPoint, activePoint, selectionMode, scrollOptions);
Example #12
0
		public void SelectAndMoveCaret(VirtualSnapshotPoint anchorPoint, VirtualSnapshotPoint activePoint, TextSelectionMode selectionMode) => EditorOperations.SelectAndMoveCaret(anchorPoint, activePoint, selectionMode);