コード例 #1
0
        private void SelectionSwapExec(Action <SelectionList, SelectionList> execute)
        {
            // Swap selections around - we rebuild the list each time to
            // capture the changes that the command has caused. We cache
            // the old list for use next time to avoid additional memory
            // allocation and GC loading.

            // Clear display so that we do not redraw annotations for every change
            this.selectionDisplay.SetSelections(null);

            var tempSelections = this.selections;

            this.selections = this.spareSelectionsList;
            this.selections.Clear();
            this.spareSelectionsList = tempSelections;

            // Add the current selection into the list so that we apply
            // the operation to the entire set of points.
            tempSelections.InsertExpectEnd(Utils.GetCurrentSelections(this.textView));

            // Do whatever we are doing
            execute(tempSelections, this.selections);

            // Remove the last selection from the list - this will be the Visual Studio
            // managed selection - we want to add then remove incase it gets merged with
            // another selection as a result of the edit - we also need to set this selection
            // as the VS selection
            this.selections.RemoveLast().SetSelection(this.textView);

            // Update selections display
            this.selectionDisplay.SetSelections(this.selections);
        }
コード例 #2
0
 protected override void Search(
     MultiCaretCommandFilter commandFilter,
     SelectionList targetSelections,
     SingleSelection firstText,
     SnapshotSpan lastText,
     FindData findData)
 {
     targetSelections.InsertExpectEnd(
         commandFilter.textSearch.FindAll(findData).ToSingleSelections(false));
 }
コード例 #3
0
 public void SetSelections(SelectionList selections)
 {
     this.currentSelections = selections;
     if (this.currentSelections == null || this.currentSelections.Count == 0)
     {
         this.ClearLayout();
     }
     else
     {
         this.UpdateLayout();
     }
 }
コード例 #4
0
 protected override void Search(
     MultiCaretCommandFilter commandFilter,
     SelectionList targetSelections,
     SingleSelection firstText,
     SnapshotSpan lastText,
     FindData findData)
 {
     SearchOne(
         commandFilter,
         firstText.GetSelectionSpan().Start.Position,
         o => o.Start.Position,
         targetSelections.InsertExpectStart,
         findData);
 }
コード例 #5
0
 protected abstract void Search(
     MultiCaretCommandFilter commandFilter,
     SelectionList targetSelections,
     SingleSelection firstText,
     SnapshotSpan lastText,
     FindData findData);