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:
Junegunn Choi committed 2026-09-27 23:48:25 +09:00
1 parent a4979fdcd4
commit 35e8ef8e20
1 file changed
+25 -13
+25 -13
View File
@@ -1680,19 +1680,31 @@ function! s:btags_sink(from, lines)
let tagname = '' let tagname = ''
call s:action_for(a:lines[0]) call s:action_for(a:lines[0])
let qfl = [] let qfl = []
for line in a:lines[1:] try
let parts = split(line, "\t") " Searched with the settings s:tags_sink and the CTRL-O callback use, and a
let excmd = s:tag_address(parts[2]) " failing address must not drop the rest of the selection
if empty(excmd) let [magic, &magic, wrapscan, &wrapscan] = [&magic, 0, &wrapscan, 1]
call s:warn('Unsupported tag address: '.s:strip(parts[0])) for line in a:lines[1:]
continue try
endif let parts = split(line, "\t")
call s:execute_tag_address(excmd) let excmd = s:tag_address(parts[2])
call add(qfl, {'filename': expand('%'), 'lnum': line('.'), 'text': getline('.')}) if empty(excmd)
if empty(tagname) throw 'Unsupported tag address: '.s:strip(parts[0])
let tagname = s:strip(parts[0]) endif
endif call s:execute_tag_address(excmd)
endfor 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 if len(qfl) > 1
" Go back to the original position " Go back to the original position