Vim: Selection highlight display inconsistent
Expect: Display selection highlight for meta-d
and Mouse Selection
the same as Double Click
.
The weird thing disturbed me is the last character is not highlighting, but it will be copied when I do y
or Ctrl-c
.
Btw, doing vaw
on a word without special character at the end of a line may select \n
and some spaces of next line.
- VSCode Version: 1.10.2
- VsCodeVim Version: 0.6.11
- OS: OS X EI Capitan 10.11.6
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Reactions: 6
- Comments: 19 (6 by maintainers)
Copied from https://github.com/VSCodeVim/Vim/issues/1711 @sebastjaeger
Environment:
What happened:
There are multiple surprising effects when selecting e.g. a word in visual mode
y
the entire word is copied and can be retrieved withp
(as expected)*
buffer in vim, mouse middle click in linux)What did you expect to happen:
Clearly show that the last character of the selection belongs to the selection. Make sure the last character is copied into the selection clipboard. Highlight other occurrences of the selection correctly.
Thanks for the write up @unnamedcrewman. I think that provides very clear motivation to fix our dumb selection bug once and for all.
I think the biggest problem here is the difference between Vim and VScode selections. In VSCode Vim, if you are yanking with “y”, the letter under the cursor is included. However, anything that relies on what vanilla VSCode considers a text selection will not actually include the letter under the cursor if the selection is made in visual mode in the same way as one does for yanking.
For what it’s worth, this means that:
The user has to remember that any selections in normal/visual (block cursor) mode look different depending on whether you are “yanking” (includes the letter under the cursor) or “copying” with ctrl-c or the Windows menu options (does not include the letter under the cursor). I suspect the average user in a Windows environment would assume yanking and copying to be the same thing. Probably many Vim users actually consider them pretty much as synonyms.
Certain extensions might give unexpected results. A user might be used to making a selection for “yanking” in visual/normal mode by ending with the cursor directly on the last character of the selection. But for an extension that manipulates text selections, the user has to remember to make sure that for any normal/visual mode selection the cursor must be placed one character past the end of the intended selection material to get the expected output.
Obviously, neither of these scenarios is a huge deal, but the second one could introduce problems that are not immediately obvious in casual reading of the output text (dropped punctuation, newlines, etc.).
Closed through https://github.com/VSCodeVim/Vim/pull/1862
@xconverge @chestnutchen Actually the last character isn’t selected in visual mode. I think it’s a bug cause by vim plugin.
https://github.com/VSCodeVim/Vim/issues/1441
https://github.com/VSCodeVim/Vim/blob/b8fd6a18cbb69cfbc34d47248dae1238dc50a8b1/src/mode/modeHandler.ts#L712
Was the last letter issue fixed? When I select with mouse from the right, it does not copy the last letter for me:
Vscodevim version: v1.21.3 on Mac. Thanks!
Double clicking a word displayed in the right place and it interacted correctly. The main issue is the highlighting selection region of
mouse selection
. Just as the follows image:I don’t know whether the last character ‘m’ is selected (Actually it is selected, but the highlighting of the references in other places of this document are wrong).
And doing
double click
it display as follows:I think the later display is better.
it’s still not fixed in v0.7.1.