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

Multicursor highlighting on selection behaves oddly #21457

Closed
atombender opened this issue Feb 26, 2017 · 7 comments
Closed

Multicursor highlighting on selection behaves oddly #21457

atombender opened this issue Feb 26, 2017 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) editor-multicursor Editor multiple cursor issues
Milestone

Comments

@atombender
Copy link

atombender commented Feb 26, 2017

  • VSCode Version: 1.9.1

Steps to Reproduce:

  1. Type the text XXXXXX
  2. Select the first X
  3. Hit cmd-D multiple times. The selection will grow exponentially:

t

I expected each cmd-D keypress to select the next X.

Furthermore, the "highlight all" behaves similarly oddly: It will highlight pairs of whatever you selected:

t2

Even weirder, if you replace the text, then undo, any adjacent selections are collapsed (so it doesn't undo the selection properly):

t3

  1. Type 20 Zs.
  2. Select one Z and "highlight all". There are now 10 selections of 2 characters each (wrong).
  3. Type "p" to replacing all of them. You get 10 p's (wrong).
  4. Undo. There are now 5 selections of 4 characters each (wrong).
  5. Type "p" to replace all of them again. You get 5 p's (wrong).
  6. And so on.
@atombender atombender changed the title Multicursor behaves oddly when combined with a selection Multicursor highlighting on selection behaves oddly Feb 26, 2017
@roblourens
Copy link
Member

The first might be expected since contiguous selections are combined. Second looks like a bug?

@atombender
Copy link
Author

Well, I did not expect the first one.

There are practical implications beyond just being weird: With the above behaviour it's impossible to select all Xs unless they occur in powers of 2. I.e. I can select 1, 2, 4, 8, ... Xs, but not, say, 10.

As for selections being combined: If I have X X X X ... (i.e. separated by spaces), it works: All instances of X are individually selected. Logically, it shouldn't matter if the Xs are next to each other or not, since my starting selection is a single character.

In other words, the behaviour is inconsistent. Not just that, it's arguably useless, because it's extremely rare to want to replace exactly 2n instances of anything.

VSC does seem capable of having multiple selections adjacent to each other, as shown by the second example (the Ys).

@atombender
Copy link
Author

Updated issue with a GIF of the third problem (affecting "highlight all").

@martin-sweeny
Copy link

I opened a similar issue... Possible duplicate of #11150 @alexandrudima

@atombender
Copy link
Author

Looks like it's the same bug. Although mine demonstrates a few more edge cases that we'll want to keep in mind in whichever issue is kept open.

@alexdima alexdima self-assigned this Mar 28, 2017
@alexdima alexdima added the editor-multicursor Editor multiple cursor issues label Mar 28, 2017
@alexdima alexdima added this to the Backlog milestone Mar 28, 2017
@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Mar 28, 2017
@paulpflug
Copy link

stumbled upon this, too. Usecase:

# replace all \n with newline
\n
\n\n
\n

currently not possible with ctrl+d, as selection changes from \n to \n\n on the second line

@alexdima
Copy link
Member

Duplicate of #6661

@alexdima alexdima added the *duplicate Issue identified as a duplicate of another issue(s) label May 21, 2017
@alexdima alexdima modified the milestones: Backlog, May 2017 May 31, 2017
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug *duplicate Issue identified as a duplicate of another issue(s) editor-multicursor Editor multiple cursor issues
Projects
None yet
Development

No branches or pull requests

6 participants