This repository has been archived by the owner on Mar 3, 2023. It is now read-only.
Don't add fully-contained selections above/below #16518
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
馃崘'd with @nathansobo
Description of the Change
This pull request updates the "add selection below/above" command to only create new selections if they will not be contained within an existing selection.
Benefits
Other than improving the performance of the above commands, this fixes #14622 by preventing the need to merge redundant intersecting selections, which was causing selections to be reversed when adding selections above.
Alternate Designs
mergeIntersectingSelections
to be smarter about the directionality of the resulting merged selections. However, those selections never needed to exist in the first place so we decided to ignore this path.TextEditor.addSelectionForBufferRange
to re-use selections when the supplied range is contained by an existing selection. We decided to not go with this approach because of the risk of breaking public APIs.Possible Drawbacks
Unclear.
Verification Process
See the reproduction steps at #14622.
Applicable Issues
Fixes #14622.