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

Ctrl+Alt+Down (selecting lines) and Alt+Up (moving them) moves only 1 line #47151

Open
user3323 opened this issue Apr 3, 2018 · 4 comments
Open
Labels
editor-contrib Editor collection of extras editor-multicursor Editor multiple cursor issues feature-request Request for new features or functionality
Milestone

Comments

@user3323
Copy link

user3323 commented Apr 3, 2018

  • VSCode Version: 1.22.0-ins
  • OS Version: win7x64

ctrl alt down

@vscodebot vscodebot bot added editor editor-contrib Editor collection of extras labels Apr 3, 2018
@alexdima alexdima added editor-multicursor Editor multiple cursor issues feature-request Request for new features or functionality and removed editor labels Apr 5, 2018
@alexdima alexdima removed their assignment Apr 5, 2018
@alexdima alexdima added this to the Backlog milestone Apr 5, 2018
@user3323
Copy link
Author

user3323 commented Apr 5, 2018

@alexandrudima

feature request? =\

@alexdima
Copy link
Member

alexdima commented Apr 5, 2018

Yes, the move or duplicate lines actions are only partially multi-cursor aware and they create bogus intersecting/conflicting edits in these cases.

Related: #41277, #40646, #19621

PR welcome in https://github.com/Microsoft/vscode/blob/1e5c0c3e4e11af82e82d7761d7875646d1c6336b/src/vs/editor/contrib/linesOperations/linesOperations.ts#L102-L104 . The current support for multi-cursor is to loop over all the selections and generate a move lines command. But a correct implementation would only invoke the command once in the case that multiple cursors sit on the same line, or that multiple cursors are within 1 line distance of each other, etc.

@irrationalRock
Copy link
Contributor

Hi, I am interested in this bug.

I have made some changes that partially fix this bug:
partial_works

I have a question about the comment you made about this line:

for (var i = 0; i < selections.length; i++) { 
 commands.push(new MoveLinesCommand(selections[i], this.down, autoIndent)); 
} 

Can you elaborate more about this?
I'm wondering how you would invoke the command once instead of multiple times.

@alexdima
Copy link
Member

Instead of using commands (which are single-cursor aware), It is possible to use editor.executeEdits which allows to apply N edits at the same time and set the N resulting selections.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
editor-contrib Editor collection of extras editor-multicursor Editor multiple cursor issues feature-request Request for new features or functionality
Projects
None yet
Development

No branches or pull requests

3 participants