-
Notifications
You must be signed in to change notification settings - Fork 13
Open
Description
Important: I fixed this bug as a byproduct of trying to fix some cw edge cases in
#69, just wanted to open an issue to link to when I send a PR
For d, there's handling for this case:
foo
^
bar
dw
becomes:
fo
^
bar
and not:
fo
bar
^
Handling:
vim-wordmotion/autoload/wordmotion.vim
Lines 127 to 141 in 81d9bd2
| " dw at the end of a line should not consume the newline or leading white | |
| " space on the next line | |
| let l:is_dw = a:mode == 'o' && v:operator == 'd' && l:flags == '' | |
| let l:next_line = l:pos[1] < getpos('.')[1] | |
| if l:is_dw && l:next_line | |
| let l:s = a:uppercase ? s:us : s:s | |
| " newline, leading whitespace, cursor | |
| if search('\m\n\%('.l:s.'\)*\%#', 'bW') != 0 | |
| let l:dwpos = getpos('.') | |
| " need to make range inclusive | |
| call setpos('.', l:pos) | |
| normal! v | |
| call setpos('.', l:dwpos) | |
| endif | |
| endif |
Bug: this needs to be handled for every operator, with the most obvious example being y
foo
^
bar
ywp
Expected:
fooo
^
bar
Got:
fooo
^
(4 leading whitespace)
bar
With mini.surround
foo
^
bar
saw)
Expected:
fo(o)
^
bar
Got:
fo(o
^
)bar
It looks safe to say that every operator should be included in the handling of this edge
case, it's just that cw has its slight differences, but that doesn't matter for this.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels