From 6f37e7f7eb79a9df8ebed2223fa7bf286c8cc866 Mon Sep 17 00:00:00 2001 From: Kirill Osenkov Date: Mon, 10 Dec 2018 17:09:47 -0800 Subject: Undo some changes that break MonoDevelop. --- ...crosoft.VisualStudio.Text.Implementation.csproj | 2 +- .../XPlat/MultiCaretImpl/MultiSelectionBroker.cs | 62 ++++++++++++---------- .../XPlat/MultiCaretImpl/SelectionTransformer.cs | 7 +-- 3 files changed, 38 insertions(+), 33 deletions(-) diff --git a/src/Microsoft.VisualStudio.Text.Implementation.csproj b/src/Microsoft.VisualStudio.Text.Implementation.csproj index b35940f..789c98d 100644 --- a/src/Microsoft.VisualStudio.Text.Implementation.csproj +++ b/src/Microsoft.VisualStudio.Text.Implementation.csproj @@ -5,7 +5,7 @@ true key.snk false - 15.2.4-pre + 15.2.5-pre 15.0.0.0 16.0.142-g25b7188c54 16.0.142-g25b7188c54 diff --git a/src/Text/Impl/XPlat/MultiCaretImpl/MultiSelectionBroker.cs b/src/Text/Impl/XPlat/MultiCaretImpl/MultiSelectionBroker.cs index 8fa180f..5beff03 100644 --- a/src/Text/Impl/XPlat/MultiCaretImpl/MultiSelectionBroker.cs +++ b/src/Text/Impl/XPlat/MultiCaretImpl/MultiSelectionBroker.cs @@ -60,33 +60,37 @@ namespace Microsoft.VisualStudio.Text.MultiSelection.Implementation private void OnTextViewLayoutChanged(object sender, TextViewLayoutChangedEventArgs e) { - using (var batchOp = BeginBatchOperation()) - { - // If we get a text change, we need to go through all the selections and update them to be in the - // new snapshot. If there is just a visual change, we could still need to update selections because - // word wrap or collapsed regions might have moved around. - if (CurrentSnapshot != e.NewSnapshot) - { - CurrentSnapshot = e.NewSnapshot; - } - else if (e.NewViewState.VisualSnapshot != e.OldViewState.VisualSnapshot) - { - // Box selection is special. Moving _boxSelection is easy, but InnerSetBoxSelection will totally - // reset all the selections. It's easier to go a different path here than it is to special case - // NormalizeSelections, which is also called when adding an individual selection. - if (IsBoxSelection) - { - // MapToSnapshot does take the visual buffer into account as well. Calling it here should do the right thing - // for collapsed regions and word wrap. - _boxSelection.Selection = _boxSelection.Selection.MapToSnapshot(_currentSnapshot, _textView); - InnerSetBoxSelection(); - } - else - { - NormalizeSelections(true); - } - } - } + if (CurrentSnapshot != e.NewSnapshot) + { + CurrentSnapshot = e.NewSnapshot; + } + //using (var batchOp = BeginBatchOperation()) + //{ + // // If we get a text change, we need to go through all the selections and update them to be in the + // // new snapshot. If there is just a visual change, we could still need to update selections because + // // word wrap or collapsed regions might have moved around. + // if (CurrentSnapshot != e.NewSnapshot) + // { + // CurrentSnapshot = e.NewSnapshot; + // } + // else if (e.NewViewState.VisualSnapshot != e.OldViewState.VisualSnapshot) + // { + // // Box selection is special. Moving _boxSelection is easy, but InnerSetBoxSelection will totally + // // reset all the selections. It's easier to go a different path here than it is to special case + // // NormalizeSelections, which is also called when adding an individual selection. + // if (IsBoxSelection) + // { + // // MapToSnapshot does take the visual buffer into account as well. Calling it here should do the right thing + // // for collapsed regions and word wrap. + // _boxSelection.Selection = _boxSelection.Selection.MapToSnapshot(_currentSnapshot, _textView); + // InnerSetBoxSelection(); + // } + // else + // { + // NormalizeSelections(true); + // } + // } + //} } private void OnTextViewClosed(object sender, EventArgs e) @@ -409,8 +413,8 @@ namespace Microsoft.VisualStudio.Text.MultiSelection.Implementation private void FireSessionUpdated() { - var changesFromNormalization = NormalizeSelections(); - _fireEvents = _fireEvents || changesFromNormalization; + //var changesFromNormalization = NormalizeSelections(); + //_fireEvents = _fireEvents || changesFromNormalization; // Perform merges as late as possible so that each region can act independently for operations. MergeSelections(); diff --git a/src/Text/Impl/XPlat/MultiCaretImpl/SelectionTransformer.cs b/src/Text/Impl/XPlat/MultiCaretImpl/SelectionTransformer.cs index e80770c..489fa18 100644 --- a/src/Text/Impl/XPlat/MultiCaretImpl/SelectionTransformer.cs +++ b/src/Text/Impl/XPlat/MultiCaretImpl/SelectionTransformer.cs @@ -438,9 +438,10 @@ namespace Microsoft.VisualStudio.Text.MultiSelection.Implementation // Using the ternary here to shortcut out if the snapshots are the same. There's a similar check in the // MapSelectionToCurrentSnapshot method to avoid doing unneeded work, but even spinning up the method call can be expensive. - _selection = (newSelection.InsertionPoint.Position.Snapshot == this.CurrentSnapshot) - ? newSelection - : MapSelectionToCurrentSnapshot(newSelection); + //_selection = (newSelection.InsertionPoint.Position.Snapshot == this.CurrentSnapshot) + // ? newSelection + // : MapSelectionToCurrentSnapshot(newSelection); + _selection = newSelection; _broker.QueueCaretUpdatedEvent(this); } -- cgit v1.2.3