From 35e8ef8e20902979234c6aba6c91d2b4535b2f03 Mon Sep 17 00:00:00 2001 From: Junegunn Choi Date: Sun, 27 Sep 2026 23:48:25 +0900 Subject: [PATCH] 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. --- autoload/fzf/vim.vim | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 0cd5e9e..f4a864b 100755 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -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