mirror of
https://github.com/junegunn/fzf.vim.git
synced 2026-10-13 08:28:58 +08:00
Allow an unterminated pattern after earlier address parts
A field holding a tab arrives cut short, so :BTags with 'ctags
--excmd=combine' sees '2;/^int tabbed(void) {' and stopped jumping. The last
part runs to the end of the line, taking any '|' or ';' with it, so it still
cannot chain a command.
This commit is contained in:
1 file changed
+6
-4
@@ -543,9 +543,10 @@ endfunction
|
|||||||
" Address of a tag, given the rest of the line after the file name. Only the
|
" 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,
|
" 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
|
" chained with ';' for '--excmd=combine' and cut at the ';"' terminator as
|
||||||
" Vim's find_extra() does. A pattern left unterminated runs to the end of the
|
" Vim's find_extra() does. The last pattern can be left unterminated, as a
|
||||||
" line, taking any '|' or ';' with it, so it cannot chain a command. Returns
|
" field holding a tab arrives cut short; it then runs to the end of the line,
|
||||||
" an empty string for anything else, which is then not run.
|
" taking any '|' or ';' with it, so it cannot chain a command. Returns an
|
||||||
|
" empty string for anything else, which is then not run.
|
||||||
let s:tag_address_part = '\%(\d\+\|/\%(\\.\|[^/\\]\)*/\|?\%(\\.\|[^?\\]\)*?\)'
|
let s:tag_address_part = '\%(\d\+\|/\%(\\.\|[^/\\]\)*/\|?\%(\\.\|[^?\\]\)*?\)'
|
||||||
let s:tag_address_open = '\%(/\%(\\.\|[^/\\]\)*\|?\%(\\.\|[^?\\]\)*\)'
|
let s:tag_address_open = '\%(/\%(\\.\|[^/\\]\)*\|?\%(\\.\|[^?\\]\)*\)'
|
||||||
function! s:tag_address(rest)
|
function! s:tag_address(rest)
|
||||||
@@ -553,7 +554,8 @@ function! s:tag_address(rest)
|
|||||||
let rest = s:strip(a:rest)
|
let rest = s:strip(a:rest)
|
||||||
let address = matchstr(rest,
|
let address = matchstr(rest,
|
||||||
\ '^'.s:tag_address_part.'\%(;'.s:tag_address_part.'\)*\ze\%(;"\|$\)')
|
\ '^'.s:tag_address_part.'\%(;'.s:tag_address_part.'\)*\ze\%(;"\|$\)')
|
||||||
return empty(address) ? matchstr(rest, '^'.s:tag_address_open.'$') : address
|
return empty(address) ? matchstr(rest,
|
||||||
|
\ '^\%('.s:tag_address_part.';\)*'.s:tag_address_open.'$') : address
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
" [key, [filename, [stay_on_edit: 0]]]
|
" [key, [filename, [stay_on_edit: 0]]]
|
||||||
|
|||||||
Reference in new issue
Block a user