vim-dentures icon indicating copy to clipboard operation
vim-dentures copied to clipboard

Wrong direction if pre-existing visual selection is backwards

Open chaoren opened this issue 10 years ago • 1 comments

Let ( ) denote the cursor position and [ ] denote visual selection.

Consider this behavior of word objects:

foo [(b)ar baz] -> aw -> [(f)oo bar baz]

The existing visual selection is backwards, therefore aw consumes a word in the reverse direction and the cursor ends up at the beginning of the selection like it was before the aw.

Currently, your plugin does this:

 ^foo$            [^foo$
[^(b)ar$ -> ai ->  ^bar$
 ^baz$]            ^baz($)]

which is wrong. Even though the visual selection itself is correct, the resulting position of the cursor is incorrect.

By analogy with the word objects, it should behave like this:

 ^foo$            [^(f)oo$
[^(b)ar$ -> ai ->  ^bar$
 ^baz$]            ^baz$]

chaoren avatar Feb 17 '16 07:02 chaoren

Interesting. I might have to completely revisit the selection logic for this, which I hate doing because I love doing it too much.

qstrahl avatar Feb 17 '16 18:02 qstrahl