Exemplo n.º 1
0
 private void TextViewSelectionChanged(object sender, EventArgs e)
 {
     if (TextView.Selection.Start != TextView.Selection.End)
     {
         _history.ClearHistoryEntrySelection();
     }
 }
Exemplo n.º 2
0
        public void ClearFilter()
        {
            if (!_history.HasEntries)
            {
                return;
            }

            _history.ClearHistoryEntrySelection();
            _textView.Selection.Clear();

            _searchPattern = null;
            var span = new Span(0, _textBuffer.CurrentSnapshot.Length);

            _elisionBuffer.ExpandSpans(new NormalizedSpanCollection(span));
        }
Exemplo n.º 3
0
        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);
            }
        }
Exemplo n.º 4
0
        private bool HandleSingleClick(InputEventArgs e, ModifierKeys modifiers)
        {
            // Don't do anything if there is no history
            if (_history.VisualComponent.TextView.TextBuffer.CurrentSnapshot.Length == 0)
            {
                _lastSelectedLineNumber = null;
                return(true);
            }

            var point      = GetAdjustedPosition(e, _history.VisualComponent.TextView);
            var lineNumber = GetLineNumberUnderPoint(point);

            if (lineNumber == -1)
            {
                _lastSelectedLineNumber = null;
                return(false);
            }

            switch (modifiers)
            {
            case ModifierKeys.None:
                _history.ClearHistoryEntrySelection();
                _history.SelectHistoryEntry(lineNumber);
                _lastSelectedLineNumber = lineNumber;
                return(false);

            case ModifierKeys.Control:
                _history.VisualComponent.TextView.Selection.Clear();
                _history.ToggleHistoryEntrySelection(lineNumber);
                _lastSelectedLineNumber = lineNumber;
                return(true);

            case ModifierKeys.Shift:
                if (!_lastSelectedLineNumber.HasValue)
                {
                    _history.ClearHistoryEntrySelection();
                    _history.SelectHistoryEntry(lineNumber);
                    _lastSelectedLineNumber = lineNumber;
                    return(false);
                }

                if (_history.HasSelectedEntries)
                {
                    if (lineNumber > _lastSelectedLineNumber.Value)
                    {
                        _history.ClearHistoryEntrySelection();
                        _history.SelectHistoryEntries(Enumerable.Range(_lastSelectedLineNumber.Value, lineNumber - _lastSelectedLineNumber.Value + 1));
                    }
                    else if (lineNumber < _lastSelectedLineNumber.Value)
                    {
                        _history.ClearHistoryEntrySelection();
                        _history.SelectHistoryEntries(Enumerable.Range(lineNumber, _lastSelectedLineNumber.Value - lineNumber + 1));
                    }

                    return(true);
                }

                return(false);

            default:
                _lastSelectedLineNumber = null;
                return(false);
            }
        }