Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix infinite loop for argument object not supported by % #285

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion autoload/targets/sources/argument.vim
Original file line number Diff line number Diff line change
Expand Up @@ -161,8 +161,14 @@ function! s:findArgBoundary(flags1, flags2, skip, finish, all, separator)

let [tl, rl, rc] = [0, 0, 0]
let [rl, rc] = searchpos(a:all, a:flags1)
let iteration = 0
while 1
if rl == 0
if iteration >= 50000
echohl ErrorMsg
echomsg "ERROR: exceded maximum number of iterations"
echohl None
return [0, 0, targets#util#fail('findArgBoundary 2')]
elseif rl == 0
return [0, 0, targets#util#fail('findArgBoundary 1', a:)]
endif

Expand All @@ -177,11 +183,17 @@ function! s:findArgBoundary(flags1, flags2, skip, finish, all, separator)
endif
break
elseif char =~# a:skip
let [lastB, lastL, lastC, curO] = getpos('.')
silent! keepjumps normal! %
let [_, curL, curC, lastO] = getpos('.')
if curL < lastL || (curL == lastL && curC < lastC) || (curL == lastL && curC == lastC && curO < lastO)
call setpos('.', [lastB, lastL, lastC, lastO])
endif
else
return [0, 0, targets#util#fail('findArgBoundary 2')]
endif
let [rl, rc] = searchpos(a:all, a:flags2)
let iteration += 1
endwhile

return [rl, rc, 0]
Expand Down