Skip to content
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
merged 1 commit into from Jan 9, 2018

Conversation

as-cii
Copy link
Contributor

@as-cii as-cii commented Jan 9, 2018

馃崘'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

  • Change the behavior of 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.
  • Change 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.

This is slower than it needs to be and creates behavioral problems when
selections get merged in some cases.

Signed-off-by: Nathan Sobo <nathan@github.com>
@nathansobo nathansobo merged commit b5c939d into master Jan 9, 2018
@nathansobo nathansobo deleted the ns-as-fix-add-selection branch January 9, 2018 17:10
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Grave accents causing visual problem with multiline selection
2 participants