Wrong direction if pre-existing visual selection is backwards
Opened this issue · 1 comments
chaoren commented
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$]
qstrahl commented
Interesting. I might have to completely revisit the selection logic for this, which I hate doing because I love doing it too much.