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

[Feature Request] Add Ability to Remove Selections when Multi-Editing with Ctrl+Click #12530

Open
theonlypwner opened this issue Nov 17, 2022 · 10 comments

Comments

@theonlypwner
Copy link

theonlypwner commented Nov 17, 2022

Description of the Issue

In Visual Studio Code, Alt+Click is the default way to add multiple cursors. If you Alt+Click an existing cursor, it will remove it.
Also, if you add another selection that overlaps an existing selection, the existing selection will be removed.

Something similar should be added to Notepad++.

It is annoying when you misclick and can't easily go back to the state before the misclick.

Steps to Reproduce the Issue

  1. Enable Multi-Editing.
  2. Add multiple cursors with Ctrl+Click, including one by accident.
  3. Try to click one of the cursors to remove it.

Expected Behavior

The cursor is removed.

Actual Behavior

The cursor is not removed.

Debug Information

N/A

@alankilborn
Copy link
Contributor

It seems reasonable that Ctrl+click of an existing caret/selection should remove that caret/selection.

However, this behavior is dependent upon Scintilla (Notepad++'s underlying editing component) behavior, and thus this issue should be given the "Scintilla dependent" label.


if you add another selection that overlaps an existing selection, the existing selection will be removed.

That already seems to be Notepad++ behavior (v8.4.7).

@theonlypwner
Copy link
Author

In VS Code 1.73.1, I can add four cursors and Alt+Click one of them to remove it. If I add a selection that overlaps an existing selection, the existing selection is removed. If a selection is adjacent to an existing cursor, the existing cursor is removed.
VSCode example

In Notepad++ 8.4.7, I cannot Ctrl+Click to remove, and adding an overlapping selection merges rather than removing the existing selection. Also, the merged selections results in multiple selections.
Notepad++ example

@alankilborn
Copy link
Contributor

I cannot Ctrl+Click to remove

Yes, accepted, and I agreed it would be reasonable for that behavior to change.

adding an overlapping selection merges rather than removing the existing selection

IMO I don't know which behavior is "correct" in this case. Are there other editors that can be cited that give weight to VS Code's method being the right one?

If I try reproducing your N++ animation, I don't get multiple carets in the end. What are you doing when the text shortens? I'd think you just pressed the a key, but when I do that I just get a single a inserted, and a single caret remains.

@theonlypwner
Copy link
Author

IMO I don't know which behavior is "correct" in this case. Are there other editors that can be cited that give weight to VS Code's method being the right one?

Just as there should be a way to remove a cursor, there has to be some way to remove a selection. Even if we still "merge" the selection like in Notepad++, there at least should be a way to click an existing selection to remove it.

If I try reproducing your N++ animation, I don't get multiple carets in the end. What are you doing when the text shortens? I'd think you just pressed the a key, but when I do that I just get a single a inserted, and a single caret remains.

I just press a, and then I get one a per cursor. As I mentioned before, the merged selection results in multiple selections (and thus multiple cursors).

@alankilborn
Copy link
Contributor

there at least should be a way to click an existing selection to remove it.

Agreed, I think several times now.

the merged selection results in multiple selections (and thus multiple cursors).

OK, I can reproduce it somewhat, interestingly not as easily as you can.

@theonlypwner
Copy link
Author

theonlypwner commented Jan 3, 2024

v8.6 added "Undo the Latest Added Multi-Select", which helps this issue, but that doesn't work if the cursor or selection to remove is not the latest.

@rdipardo
Copy link
Contributor

rdipardo commented Jan 3, 2024

@theonlypwner

there at least should be a way to click an existing selection to remove it.

Try 8.6.1:

Ctrl-click on a selection deselects it in multiple selection mode.

@theonlypwner
Copy link
Author

theonlypwner commented Jan 4, 2024

I can confirm that this issue is fixed in v8.6.1.RC.

It's different from VS Code in that it merges overlapping selections instead of removing old ones, but that's perfectly acceptable.

It just so happened that 8.6 is the current version when I tested, while the upcoming 8.6.1 will fix it. If I had checked on this issue later, it might have already been fixed.

@alankilborn
Copy link
Contributor

@theonlypwner

It's different from VS Code in that it merges overlapping selections instead of removing old ones, but that's perfectly acceptable.

I don't understand what you meant by this statement.
There's no merging going on here, just removal of a single caret/selection from the rest of the groups of carets/selections.

@theonlypwner
Copy link
Author

theonlypwner commented Jan 4, 2024

@alankilborn see the animations in #12530 (comment)

In Notepad++, if you make a new selection that partially overlaps an existing selection, they are merged to form two selections, which is different from VS Code, which removes the old selection.

If the new selection completely covers an existing selection, the old selection is removed, which is the same as in VS Code.

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

No branches or pull requests

3 participants