Fix d]% when close is at column 1, fix #203

This commit is contained in:
Andy K. Massimino
2022-01-08 11:08:41 -05:00
parent 85c65f4594
commit ecca332fca
2 changed files with 13 additions and 2 deletions

View File

@@ -196,7 +196,7 @@ function! matchup#motion#find_unmatched(visual, down, ...) " {{{1
" this is an exclusive motion, ]%
if l:delim.side ==# 'close'
if l:exclusive
let l:new_pos[1] -= 1
let l:new_pos = matchup#pos#prev_eol(l:new_pos)[1:2]
else
let l:new_pos[1] += matchup#delim#end_offset(l:delim)
endif

View File

@@ -73,6 +73,17 @@ function! matchup#pos#next(...) " {{{1
endif
endfunction
" }}}1
function! matchup#pos#prev_eol(...) " {{{1
let [l:lnum, l:cnum; l:rest] = s:parse_args(a:000)
if l:cnum >= 1 && l:lnum > 1
return [0, l:lnum - 1, strlen(getline(l:lnum - 1)) + 1, 0]
else
return matchup#pos#prev(l:lnum, l:cnum)
endif
endfunction
" }}}1
function! matchup#pos#prev(...) " {{{1
let [l:lnum, l:cnum; l:rest] = s:parse_args(a:000)
@@ -86,6 +97,7 @@ function! matchup#pos#prev(...) " {{{1
endfunction
" }}}1
function! matchup#pos#larger(pos1, pos2) " {{{1
return matchup#pos#val(a:pos1) > matchup#pos#val(a:pos2)
endfunction
@@ -140,4 +152,3 @@ endfunction
let &cpo = s:save_cpo
" vim: fdm=marker sw=2