public async Task SelectNextHistoryEntry(int[] linesToSelect, string selectedText, int selectedLineIndex) { var input = @"f <- function() { print(42) } g <- function() { print(7*9) } h <- function() { print(42) }"; _history.AddToHistory(input); foreach (var line in linesToSelect) { _history.SelectHistoryEntry(line); } await DoEvents(); _history.SelectNextHistoryEntry(); await DoEvents(); var selectedSpans = _history.GetSelectedHistoryEntrySpans(); var selectedSpan = selectedSpans.Should().ContainSingle().Which; selectedSpan.GetText().Should().Be(selectedText); var selectedTextViewLine = _historyVisualComponent.TextView.TextViewLines.GetTextViewLineContainingBufferPosition(selectedSpan.Start); selectedTextViewLine.VisibilityState.Should().Be(VisibilityState.FullyVisible); }
private bool HandleSingleClick(InputEventArgs e, ModifierKeys modifiers) { // Don't do anything if there is no history if (_history.VisualComponent.TextView.TextBuffer.CurrentSnapshot.Length == 0) { return(true); } var point = GetAdjustedPosition(e, _history.VisualComponent.TextView); var lineNumber = GetLineNumberUnderPoint(point); if (lineNumber == -1) { return(false); } switch (modifiers) { case ModifierKeys.None: _history.ClearHistoryEntrySelection(); _history.SelectHistoryEntry(lineNumber); return(false); case ModifierKeys.Control: _history.VisualComponent.TextView.Selection.Clear(); _history.ToggleHistoryEntrySelection(lineNumber); return(true); case ModifierKeys.Shift: if (_history.HasSelectedEntries) { _history.SelectHistoryEntriesRangeTo(lineNumber); return(true); } return(false); default: return(false); } }