diff --git a/autoload/fzf/vim.vim b/autoload/fzf/vim.vim index 7101ec8..054ebae 100755 --- a/autoload/fzf/vim.vim +++ b/autoload/fzf/vim.vim @@ -550,19 +550,26 @@ endfunction " Address of a tag, given the rest of the line after the file name. Only the " forms a tags file is meant to hold, a line number and a search pattern, " chained with ';' for '--excmd=combine' and cut at the ';"' terminator as -" Vim's find_extra() does. The last pattern can be left unterminated, as a -" field holding a tab arrives cut short; it then runs to the end of the line, -" taking any '|' or ';' with it, so it cannot chain a command. Returns an -" empty string for anything else, which is then not run. +" Vim's find_extra() does. Returns an empty string for anything else, which is +" then not run. +" +" A pattern holding a tab reaches :BTags cut short, since it reads the field on +" its own. Such a fragment matches the wrong line, so keep only the parts before +" it, and accept an unterminated pattern alone, which is the whole address in a +" helptags file. Running to the end of the line, it takes any '|' or ';' with it, +" so it cannot chain a command either. let s:tag_address_part = '\%(\d\+\|/\%(\\.\|[^/\\]\)*/\|?\%(\\.\|[^?\\]\)*?\)' let s:tag_address_open = '\%(/\%(\\.\|[^/\\]\)*\|?\%(\\.\|[^?\\]\)*\)' function! s:tag_address(rest) " :BTags aligns its columns, so its field arrives padded let rest = s:strip(a:rest) - let address = matchstr(rest, - \ '^'.s:tag_address_part.'\%(;'.s:tag_address_part.'\)*\ze\%(;"\|$\)') - return empty(address) ? matchstr(rest, - \ '^\%('.s:tag_address_part.';\)*'.s:tag_address_open.'$') : address + let chain = '^'.s:tag_address_part.'\%(;'.s:tag_address_part.'\)*' + let address = matchstr(rest, chain.'\ze\%(;"\|$\)') + if !empty(address) + return address + endif + let address = matchstr(rest, chain.'\ze;[/?]') + return empty(address) ? matchstr(rest, '^'.s:tag_address_open.'$') : address endfunction " [key, [filename, [stay_on_edit: 0]]]