public StubTextCaret(StubWpfTextView wpfTextView) { _wpfTextView = wpfTextView; this._textBuffer = wpfTextView.TextBuffer; this._insertionPoint = new VirtualSnapshotPoint(new SnapshotPoint(_textBuffer.CurrentSnapshot, 0)); this._caretAffinity = PositionAffinity.Successor; }
public StubTextSelection(StubWpfTextView textView) { _wpfTextView = textView; this._activePoint = this._anchorPoint = new VirtualSnapshotPoint(this._wpfTextView.TextSnapshot, 0); this._selectionMode = TextSelectionMode.Stream; }
public void SetSelection(StubWpfTextView textView) { var selection = CaretSelection; if (selection == null) { return; } textView.Selection.Select(new SnapshotSpan( GetSnapshotPoint(textView.TextSnapshot, selection.Start.Line, selection.Start.Column), GetSnapshotPoint(textView.TextSnapshot, selection.End.Line, selection.End.Column)), false); }
public static StubWpfTextView CreateTextView(StubIdeScope ideScope, TestText inputText, string newLine = null, IProjectScope projectScope = null, string contentType = "deveroom", string filePath = null) { var textBuffer = VsxStubObjects.CreateTextBuffer(inputText.ToString(newLine)); textBuffer.Properties.AddProperty(typeof(IProjectScope), projectScope); if (filePath != null) { textBuffer.Properties.AddProperty(typeof(IVsTextBuffer), new FilePathProvider(filePath)); } var textView = new StubWpfTextView(textBuffer); if (contentType == "deveroom") { var tagAggregator = new StubBufferTagAggregatorFactoryService(ideScope).CreateTagAggregator <DeveroomTag>(textView.TextBuffer); tagAggregator.GetTags(new SnapshotSpan(textView.TextSnapshot, 0, textView.TextSnapshot.Length)).ToArray(); } inputText.SetSelection(textView); inputText.SetCaret(textView); return(textView); }