Skip to content

Mirror cursor makes extra copy when duplicating row #87161

Closed

Description

  • 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

Activity

  1. vscodebot commented on Dec 17, 2019

    @vscodebot

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

  2. added
    html
    on Dec 17, 2019
  3. added
    bug
    on Dec 17, 2019
  4. octref commented on Dec 17, 2019

    @octref
    Contributor

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

  5. added this to the Backlog milestone on Dec 17, 2019
  6. SavchukSergey commented on Dec 19, 2019

    @SavchukSergey
    Author

    Alexandru Dima (@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.

  7. hamzahamidi commented on Dec 21, 2019

    @hamzahamidi
    Contributor

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

  8. Errors4l commented on Dec 24, 2019

    @Errors4l

    Hamza Hamidi (@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).

  9. hamzahamidi commented on Dec 24, 2019

    @hamzahamidi
    Contributor

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

  10. Errors4l commented on Dec 24, 2019

    @Errors4l

    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).

  11. added
    editor-synced-region
    on Jan 10, 2020
  12. octref commented on Mar 18, 2020

    @octref
    Contributor

    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)

  13. locked and limited conversation to collaborators on May 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugeditor-multicursoreditor-synced-regionhtmlverified

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions