Skip to content

Fixed #4375 - Multiple Cursors now go to the next logical line - #49318

Merged
Alexandru Dima (alexdima) merged 3 commits into
microsoft:masterfrom
irrationalRock:fix-4375
May 28, 2018
Merged

Alexandru Dima (alexdima) merged 3 commits into
microsoft:masterfrom
irrationalRock:fix-4375

Conversation

@irrationalRock

Copy link
Copy Markdown
Contributor

This PR fixes #4375.

When adding multiple cursors it now only creates cursors for logical lines instead of visual lines.

Adding Cursors Down:
movedown

Adding Cursors Up:
moveup

Thanks for considering this PR.

@alexdima Alexandru Dima (alexdima) left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sorry, but this is not a good way to tackle this.

This should be implemented inside CursorMoveCommands.addCursorUp and CursorMoveCommands.addCursorDown which should each get a new argument if they should use the view model or the model. In both of these functions, MoveOperations.translateDown or MoveOperations.translateUp can accept the view model or the model.

Then, InsertCursorAbove and InsertCursorBelow can use a new introduced argument by looking at the args passed in to their run methods.

Finally, this new behaviour would be something triggerable via passing args to the keybindings. e.g.:

{
  "key": "alt+cmd+up",
  "command": "editor.action.insertCursorAbove",
  "when": "editorTextFocus",
  "args": {
    "logicalLines": true
  }
},

The argument can be called something different than logicalLine. I'm not sure of a good name at this time.

@irrationalRock

Copy link
Copy Markdown
Contributor Author

Thanks for your feedback. I'll take your suggestions and hopefully have something out by the end of the week.

@irrationalRock

Copy link
Copy Markdown
Contributor Author

alexandrudima . A made a couple of changes based on your suggestions.

First I move my logical line logic to addCursorDown/addCursorUp. It now takes in an additional argument for the model. That allows to choose whether you want to have logical line enabled or not.

However, I need a bit of help when it comes to turning this option on and off. I saw that you mentioned that it would be possible to have be triggerable via keybindings. Would the logicalLine args be passed through to EditorAction constructor?

Do you want it to look like how the down variable is implemented in AbstractMoveLinesAction?

I'm wondering can you expand on that?

@alexdima

Copy link
Copy Markdown
Member

👍

@alexdima Alexandru Dima (alexdima) added this to the May 2018 milestone May 28, 2018
@alexdima
Alexandru Dima (alexdima) merged commit 3fc3f61 into microsoft:master May 28, 2018
@github-actions github-actions Bot locked and limited conversation to collaborators Mar 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Creating multiple cursors by using Cmd-Option-Down arrow goes to the next visual line, not the next logical line

2 participants