Esempio n. 1
0
        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));
            }
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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());
        }
Esempio n. 4
0
        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);
        }
Esempio n. 5
0
        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();
        }
Esempio n. 6
0
        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());
        }
Esempio n. 7
0
        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));
            }
        }
Esempio n. 8
0
        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));
            }
        }
Esempio n. 9
0
        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);