[Bug]: Outer doesn't work for subword
musjj opened this issue · 6 comments
Bug Description
require("various-textobjs").subword
always performs action on inner word regardless if it's called with true
or false
.
Relevant Screenshot
No response
To Reproduce
- Run
daS
on a word - Spaces will be left
neovim version
v0.10.0-dev-355+g3ae62c470
Make sure you have done the following
- I have updated to the latest version of the plugin.
Thanks for the speedy update, but it doesn't seem to work:
the quick brown fox jumped over the lazy dog
^
daS
Expected:
the brown fox jumped over the lazy dog
Got:
the brown fox jumped over the lazy dog
ah right, forgot to move the dash to the end of the set. fixed.
Thank you again!
One small nitpick: there's an edge case with ending words
the quick brown fox
^
daS
Expected:
the quick brown
^
Got (it leaves a space in the end):
the quick brown
^
yeah, outer only affects trailing characters, so this result is somewhat intended.
A clean implementation of affecting the preceding character when on the last word of a line would require some extra implementation since the current mechanism does not pay attention to that.
Also, it would add quite a bit of ambiguity in some edge cases (e.g. not visible trailing whitespace affecting how trailing underscores are treated), so I am not even sure that something like that would be desirable. Feel free to open a FR for that, where this can be discussed if other people are interested in it.
The Expected:
results is how the native word object works with nvim --clean
, but I guess I can live with that. Thanks for the quick fixes!
yeah, I know and I can see where you are coming from, but the fact that the subword textobj also consideres _
and -
as potential trailing characters complicates this and leads to some weird edge cases.
Not saying that I'm against it, just that a proper implementation would be quite tricky