public void PreviousEntry() { if (!HasEntries) { return; } if (_currentEntry == null) { _currentEntry = _entries.Last(); } else { while (_currentEntry.Previous != null) { _currentEntry = _currentEntry.Previous; if (!_historyTextBuffer.IsContentEqualsOrdinal(_currentEntry.Next.Span, _currentEntry.Span)) { break; } } } if (_currentEntry != null) { _interactiveWorkflow.Operations.ReplaceCurrentExpression(_currentEntry.Span.GetText(_historyTextBuffer.CurrentSnapshot)); } }
public void Remove(IRHistoryEntry historyEntry) { var entry = historyEntry as Entry; if (entry == null || entry.Owner != this) { throw new ArgumentException(nameof(historyEntry)); } _selectedEntries.RemoveSorted(entry, EntryComparer); DeleteEntry(entry); }
private void MakeTextBufferReadOnly() { using (var edit = _historyTextBuffer.CreateReadOnlyRegionEdit()) { var span = new Span(0, edit.Snapshot.Length); _readOnlyRegion = edit.CreateReadOnlyRegion(span, SpanTrackingMode.EdgeInclusive, EdgeInsertionMode.Deny); edit.Apply(); } _currentEntry = null; HistoryChanged?.Invoke(this, new EventArgs()); }
private void SelectAndDisplayEntry(IRHistoryEntry entryToSelect, ViewRelativePosition relativeTo) { entryToSelect.IsSelected = true; var snapshotPoint = relativeTo == ViewRelativePosition.Top ? entryToSelect.Span.GetStartPoint(_historyTextBuffer.CurrentSnapshot) : entryToSelect.Span.GetEndPoint(_historyTextBuffer.CurrentSnapshot); var line = VisualComponent.TextView.GetTextViewLineContainingBufferPosition(snapshotPoint); if (line.VisibilityState != VisibilityState.FullyVisible) { VisualComponent.TextView.DisplayTextLineContainingBufferPosition(snapshotPoint, 0, relativeTo); } OnSelectionChanged(); }
public void NextEntry() { if (_currentEntry == null) { return; } while (_currentEntry.Next != null) { _currentEntry = _currentEntry.Next; if (!_historyTextBuffer.IsContentEqualsOrdinal(_currentEntry.Previous.Span, _currentEntry.Span)) { break; } } if (_currentEntry != null) { _interactiveWorkflow.Operations.ReplaceCurrentExpression(_currentEntry.Span.GetText(_historyTextBuffer.CurrentSnapshot)); } }
public void PreviousEntry() { if (_currentEntry == null) { _currentEntry = _entries.LastOrDefault(); } else while (_currentEntry.Previous != null) { _currentEntry = _currentEntry.Previous; if (!_historyTextBuffer.IsContentEqualsOrdinal(_currentEntry.Next.Span, _currentEntry.Span)) { break; } } if (_currentEntry != null) { _interactiveWorkflow.Operations.ReplaceCurrentExpression(_currentEntry.Span.GetText(_historyTextBuffer.CurrentSnapshot)); } }
private void SelectAndDispalyEntry(IRHistoryEntry entryToSelect, ViewRelativePosition relativeTo) { entryToSelect.IsSelected = true; var snapshotPoint = relativeTo == ViewRelativePosition.Top ? entryToSelect.Span.GetStartPoint(_historyTextBuffer.CurrentSnapshot) : entryToSelect.Span.GetEndPoint(_historyTextBuffer.CurrentSnapshot); var line = VisualComponent.TextView.GetTextViewLineContainingBufferPosition(snapshotPoint); if (line.VisibilityState != VisibilityState.FullyVisible) { VisualComponent.TextView.DisplayTextLineContainingBufferPosition(snapshotPoint, 0, relativeTo); } OnSelectionChanged(); }
private void SelectAndDisplayEntry(IRHistoryEntry entry) => _history.SelectAndDisplayEntry(entry, _isReversed ? ViewRelativePosition.Top : ViewRelativePosition.Bottom);