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

CMD+D and multicursor selection #10074

Closed
normalser opened this issue Aug 3, 2016 · 6 comments
Closed

CMD+D and multicursor selection #10074

normalser opened this issue Aug 3, 2016 · 6 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-multicursor Editor multiple cursor issues verified Verification succeeded
Milestone

Comments

@normalser
Copy link

  • VSCode Version: 1.4.0-insiders
  • OS Version: OSX

Steps to Reproduce:

  1. Create file with:
abc def
abc def
abc def
  1. Put your cursor at 1,1 location
  2. Hit CMD+D 3 times to select abcs
    image
  3. Hit right 3 times to get into middle of def
  4. Hit CMD+D
  5. Problem: - It will select first def only - it should select all of them

image

For comparison result of the same in Atom/Sublime:
image

@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Aug 12, 2016
@alexdima alexdima added this to the Backlog milestone Aug 12, 2016
@duydao
Copy link

duydao commented Nov 18, 2016

@alexandrudima I'm really interested to getting this fixed. Still switching to sublime text for some tasks because of this.

Can you give me a hint in which module I could start looking for this bug?

@duydao
Copy link

duydao commented Dec 27, 2016

@alexandrudima The problematic line is https://github.com/Microsoft/vscode/blob/master/src/vs/editor/contrib/find/common/findController.ts#L541. This line takes the latest cursor as start position when searching for matches.

Shouldn't it ignore empty selections and use the end of the last non-empty selection as last position when searching for matchings?

btw: when having multiple selections, Sublime Text will expand empty selections to select the word instead of looking for the next selection.

@npx
Copy link

npx commented Dec 27, 2016

(Just a clarification)

In the case of:

abc f|oo        abc [f|oo]
abc b|ar    ->  abc [b|ar]
abc p|izza      abc [p|izza]

hitting CMD+D should select the full word the cursor is currently over, not just the same match.

Edit:
Maybe this could be done with offering a "expandSelectionToWord" action that can be called on multiple cursors?

@duydao
Copy link

duydao commented Dec 28, 2016

@npx actually, it's even easier to create a plugin that replaces the cmd/ctrl+d command. In fact, I've just created one that works as I would've expected. If you're interested, you can find it here:

https://github.com/duydao/vscode-expand-selections

@Kerollmops
Copy link

Really interested in an option like expandSelectionToWord too ! 😄

@alexdima alexdima added the editor-multicursor Editor multiple cursor issues label Feb 3, 2017
@alexdima alexdima modified the milestones: February 2017, Backlog Feb 3, 2017
@alexdima
Copy link
Member

alexdima commented Feb 3, 2017

cmd+d (or ctrl+d on Windows) will now behave as described:

abc piz|za
abc ho|use
abc b|ar
--------------
abc [pizza]
abc [house]
abc [bar]

@roblourens roblourens added the verified Verification succeeded label Feb 23, 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 editor-multicursor Editor multiple cursor issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

6 participants