Example #1
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));
        }
        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);
            }
        }