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

Mirror cursor makes extra copy when duplicating row #87161

Closed
SavchukSergey opened this issue Dec 17, 2019 · 8 comments
Closed

Mirror cursor makes extra copy when duplicating row #87161

SavchukSergey opened this issue Dec 17, 2019 · 8 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug editor-multicursor Editor multiple cursor issues editor-synced-region Issues related to synced region functionality in editor html HTML support issues verified Verification succeeded
Milestone

Comments

@SavchukSergey
Copy link

  • VSCode Version: 1.41
  • OS Version: Windows 10 Enterprise

Steps to Reproduce:

  1. Write singleline html tag, e.g.:
<div></div>
  1. Put cursor inside tag name. Cursor is mirrored as expected
  2. Press duplicate line (alt+shift+down). This results in three html line
<div></div>
<div></div>
<div></div>

When cursor is not inside tag name everything is ok

Does this issue occur when all extensions are disabled?: Yes

@vscodebot
Copy link

vscodebot bot commented Dec 17, 2019

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@vscodebot vscodebot bot added the html HTML support issues label Dec 17, 2019
@aeschli aeschli assigned octref and unassigned aeschli Dec 17, 2019
@octref octref added the bug Issue identified by VS Code Team member as probable bug label Dec 17, 2019
@octref
Copy link
Contributor

octref commented Dec 17, 2019

@alexdima Would you take a PR that makes "duplicate line" only duplicate one line when both cursors are on the same line?

@octref octref added this to the Backlog milestone Dec 17, 2019
@SavchukSergey
Copy link
Author

@alexdima Would you take a PR that makes "duplicate line" only duplicate one line when both cursors are on the same line?

Or it might be more generic solution. Group all cursors by line number and then duplicate each line only once. If I add 3 cursors on first line, 5 cursors on second line and so on then press duplicate I do not need so much copies.

@hamzahamidi
Copy link
Contributor

I don't think this is can be considered a bug. Double cursors create double duplicates. This is the normal behavior.

@Errors4l
Copy link

@hamzahamidi That'd be fine if the user created the mirror cursor with an action (keyboard shortcut). Now you have to make sure where your cursor is located within a line before duplicating it, because the mirror cursor is created automatically when your main cursor is within a html tag.

It is possible to get rid of the mirror cursor with Esc, but that's an additional action to work around the problem. I find it hard to think of use cases where you would want to duplicate a line as many times as there's a cursor in that line (and then there's also a difference between multiple cursors and mirrored cursors).

@hamzahamidi
Copy link
Contributor

The automatic double cursor is needed to edit the tag just once.

@Errors4l
Copy link

Errors4l commented Dec 24, 2019

Couldn't agree with you more. That's the entire point of the feature shipped in this months update. That said, the duplicate (and other) behaviour seems like an oversight during development.

The mirror cursor is meant to simplify modification of the tag. Duplicating the line with the mirrored cursor (be it on the same or other line) is a bit strange, as the intent was to duplicate the primary line and not the html tag (note the command name is Copy Line Down).

I feel like the mirror cursor is something unique and different from multiple cursors. It shouldn't follow the same behaviour as the normal cursor(s). Differentiating between them with visual styles would also communicate that better to the user (#85630).

@octref octref added the editor-synced-region Issues related to synced region functionality in editor label Jan 10, 2020
@alexdima alexdima added the editor-multicursor Editor multiple cursor issues label Jan 16, 2020
@octref
Copy link
Contributor

octref commented Mar 18, 2020

In tomorrow's insiders html.mirrorCursorOnMatchingTag is replaced with editor.renameOnType. The new implementation fixes this issue. You can find more details here: #88424 (comment)

@octref octref closed this as completed Mar 18, 2020
@octref octref modified the milestones: Backlog, March 2020 Mar 18, 2020
@gregvanl gregvanl added the verified Verification succeeded label Apr 2, 2020
@github-actions github-actions bot locked and limited conversation to collaborators May 2, 2020
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 editor-synced-region Issues related to synced region functionality in editor html HTML support issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

7 participants