Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Click within a non-zero-length multi-selection to remove #50

Closed
wants to merge 1 commit into from

Conversation

bradymadden97
Copy link
Contributor

Why

Currently if you have multiple selections in an editor, Cmd+Clicking a 0-length selection will remove it, but Cmd+Clicking a >0-length selection will not:

Screen.Recording.2023-03-27.at.5.43.50.PM.mov

This is because the .eq method compares both head and anchor. When you have a non-zero-length selection those values will not be the same, but the click range will be the same, so .eq will never return true.

Instead, we should check if the click range is anywhere within a selection range when deciding it remove it.

Test Plan

Now, both 0-length and >0-length selections can be added and removed:

Screen.Recording.2023-03-27.at.5.42.44.PM.mov

@marijnh marijnh closed this in 3f1b991 Mar 28, 2023
@marijnh
Copy link
Member

marijnh commented Mar 28, 2023

That seems like a good idea. Attached, slightly different patch adds this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants