mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-10-01 07:53:45 +08:00
Search a BTags address as the other paths do
The sink left 'magic' and 'wrapscan' at the user's values, so a ctags pattern holding '*' or '.' could land on an earlier line than the CTRL-O preview shows, and a failing address threw out of the loop, dropping the rest of a multi-selection.
This commit is contained in:
1 file changed
+25
-13
+25
-13
@@ -1680,19 +1680,31 @@ function! s:btags_sink(from, lines)
|
||||
let tagname = ''
|
||||
call s:action_for(a:lines[0])
|
||||
let qfl = []
|
||||
for line in a:lines[1:]
|
||||
let parts = split(line, "\t")
|
||||
let excmd = s:tag_address(parts[2])
|
||||
if empty(excmd)
|
||||
call s:warn('Unsupported tag address: '.s:strip(parts[0]))
|
||||
continue
|
||||
endif
|
||||
call s:execute_tag_address(excmd)
|
||||
call add(qfl, {'filename': expand('%'), 'lnum': line('.'), 'text': getline('.')})
|
||||
if empty(tagname)
|
||||
let tagname = s:strip(parts[0])
|
||||
endif
|
||||
endfor
|
||||
try
|
||||
" Searched with the settings s:tags_sink and the CTRL-O callback use, and a
|
||||
" failing address must not drop the rest of the selection
|
||||
let [magic, &magic, wrapscan, &wrapscan] = [&magic, 0, &wrapscan, 1]
|
||||
for line in a:lines[1:]
|
||||
try
|
||||
let parts = split(line, "\t")
|
||||
let excmd = s:tag_address(parts[2])
|
||||
if empty(excmd)
|
||||
throw 'Unsupported tag address: '.s:strip(parts[0])
|
||||
endif
|
||||
call s:execute_tag_address(excmd)
|
||||
call add(qfl, {'filename': expand('%'), 'lnum': line('.'), 'text': getline('.')})
|
||||
if empty(tagname)
|
||||
let tagname = s:strip(parts[0])
|
||||
endif
|
||||
catch /^Vim:Interrupt$/
|
||||
break
|
||||
catch
|
||||
call s:warn(v:exception)
|
||||
endtry
|
||||
endfor
|
||||
finally
|
||||
let [&magic, &wrapscan] = [magic, wrapscan]
|
||||
endtry
|
||||
|
||||
if len(qfl) > 1
|
||||
" Go back to the original position
|
||||
|
||||
Reference in new issue
Block a user