-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Deselect multi caret when alt clicking on it #80956
Conversation
a7f69f2
to
4f1bc7d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this implementation, in all honesty I wonder why this wasn't part of the initial implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, the comment punctuation needs to be fixed though
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested locally (rebased on top of master
6758a7f), it mostly works as expected.
However, with this PR, unlike in VS Code, it's not possible to deselect a character/word selection by holding Alt and clicking the selection or the caret:
simplescreenrecorder-2023-08-25_00.08.55.mp4
4f1bc7d
to
a67965e
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, would be nice to add a unit test :)
a67965e
to
732c395
Compare
@Calinou fixed, you can now deselect by clicking its selection |
732c395
to
2ecbac3
Compare
2ecbac3
to
aac1070
Compare
Thanks! |
Fixes #80895
If a caret can't be added it checks if it already exists and then removes it. So now it works similarly to vscode when alt clicking once adds a caret, and alt clicking again removes it.
It does loop through the carets twice but preventing that would require changing the return value of add_caret and therefore break compatibility. The amount of carets are always quite low so the performance impact should be neglectable.