kakoune: w and do not work as expected when end of selection falls on end of word.
Steps
Put the following text in a buffer:
c ccc ccc ccc
cc ccc ccc ccc
Move to the second line and do <a-h> to get your grey cursor to the beginning. If you do one <a-w>, the text "cc " at the beginning of the line will be selected. That’s what is supposed to happen. Now, try the same thing on the first line.
Outcome
The first “c” is not included in the resulting selection.
Expected
The first “c” should be in the selection.
Edit: A more refined test case:
[ abcd]e abc a w
abc[de ]abc a
OK, fine…
[ abcde] abc a w
abcde[ ]abc a
…wait, what?
[ abcde ] abc a w
abcde[ ]abc a
OK, I declare shenanigans.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Comments: 16 (6 by maintainers)
OK, good, I’m glad I’m not going insane, here.
w
and<a-w>
badly need to get unfucked. I also tried doing it the kakoune way, and found the same inconsistencies and more.Why are these:
different from this:
Please tell me you can see this glaring irregularity in how the rules are enforced.
(I’m just now gave my first try to
kakoune
.)Documentation as suggested:
(It means
[selected text]
.)How <kbd>l</kbd> works?
[a]bc
->a[b]c
. So selection doesn’t include the current character.How <kbd>w</kbd> works?
[a]bc
->[abc]
. Identical word usage in documentation but selection includes the current character.One more thing:
Now try it out in practice:
It must be black magic because “a” is a word character that was simply skipped. I really want to know what’s the explanation of this, just please don’t tell it’s “documented” or “it works right”. Because it doesn’t… or if yes, I won’t thinking anymore whether I should switch to
kakoune
or not.So you say <kbd>w</kbd> skips the current gray block, that’s why “c” didn’t become selected? Then it doesn’t work well in the 100-ε percent of cases.
Between? So you say too that space is surrounded by word characters? I can also confirm from several sources that “a” is classified as a word character.
No. Sometimes people just simply need to “select the word and following whitespaces on the right of selection end” and they want to do it using <kbd>w</kbd> as documented.
The explanation why. (You can switch it off in nvim.)
In Vim there are inclusive and exclusive motions and motions with
v
become inclusive.I’ll try to deepen my reflection on the subject soon.
Meanwhile, after a bit of research, it turns out that the question was asked a while ago: https://github.com/mawww/kakoune/issues/752 but mawww explanation was pretty light.