Vim: Html tag mirror causes issues with visual line select.

Created on 13 Dec 2019  路  9Comments  路  Source: VSCodeVim/Vim

Html tag mirror causes issues with visual line select etc.

To Reproduce
Steps to reproduce the behavior:

  1. Place cursor in html tag, press shift v and both the top/bottom html tags are selected

Expected behavior
When I tried to visually select some text to grab it and copy somewhere else, the second cursor on the top tag will select everything I don't want, unrelated to what I intended to select.

  • Extension (VsCodeVim) version: 1.12.2
  • VSCode version: 1.41.0
  • OS: Win 10

Temporary fix
html.mirrorCursorOnMatchingTag = false

I don't have a lot of time right now, if this needs more clarification let me know.

aremulticursor kinbug

Most helpful comment

Can also confirm that this is an issue even if you revert to a previous VSCodeVim version.

Seems that the issue was introduced with VS Code's update that introduced HTML mirror tags.

This feature works by adding a multi-cursor to the matching tag when your cursor moves into an HTML tag name range. Just like in multi-cursor mode, you can use word-wise deletion or word-wise selection. The mirrored cursor is removed when you move your cursor outside the tag name range.

Disabling VS Code's html.mirrorCursorOnMatchingTag setting seems to do the trick for now.

All 9 comments

Seeing the same happening, have to suppress error.
OS: Linux
VsCodeVim: 1.12.2

Can also confirm that this is an issue even if you revert to a previous VSCodeVim version.

Seems that the issue was introduced with VS Code's update that introduced HTML mirror tags.

This feature works by adding a multi-cursor to the matching tag when your cursor moves into an HTML tag name range. Just like in multi-cursor mode, you can use word-wise deletion or word-wise selection. The mirrored cursor is removed when you move your cursor outside the tag name range.

Disabling VS Code's html.mirrorCursorOnMatchingTag setting seems to do the trick for now.

@micka190 Yes it happens also on previous VSCodeVim version.
OS: Linux
VSCode version: 1.41.0
VSCodeVim version: 1.11.3

I actually just get an error message when I try this. What's the expected behavior, though? Enabling the setting means you want there to be a second cursor when on an HTML tag, so I'm not sure why V wouldn't affect both cursors.

I actually just get an error message when I try this. What's the expected behavior, though? Enabling the setting means you want there to be a second cursor when on an HTML tag, so I'm not sure why V wouldn't affect both cursors.

<p>stuff I don't want selected</p>
<div class="hello">
1
2
3
</div>

If I start at the closing div and select upwards, the mirrored cursor will select "stuff I don't want selected" because the mirror cursor starts at the top tag and selects upwards from there as well.

@syfenx You'll also straight-up get an error message if you have something like:

<p[cursor here]>foo bar</p>

And try to do a visual selection.

If I start at the closing div and select upwards, the mirrored cursor will select "stuff I don't want selected" because the mirror cursor starts at the top tag and selects upwards from there as well.

Totally get that - this seems annoying and counter-intuitive. But aside from just disabling the setting, how would this be addressed? I can only think of sort of hacky ways to figure out that the user didn't request this cursor so certain actions (like Vk, but probably not just V, for instance) are processed differently, which also seems counter-intuitive.

Just to help with visibility (for people searching for this issue), this is the error I am experiencing when I follow issuer's repro steps:

ModeHandler: unexpected selection mode. selectionMode=4

Source: Vim (Extension)

This was driving me nuts but disabling html.mirrorCursorOnMatchingTag fixed it for me as well

Was this page helpful?
0 / 5 - 0 ratings

Related issues

WangRongda picture WangRongda  路  3Comments

gerardmrk picture gerardmrk  路  3Comments

ghost picture ghost  路  3Comments

AndersenJ picture AndersenJ  路  3Comments

typeoneerror picture typeoneerror  路  3Comments