End an address fragment at a tab

On the :Tags path the rest of the line carries the extension fields, and an
unterminated pattern took them into the search, so '/^foo' became
'/^foo<Tab>f<Tab>file:' and found nothing. A helptags address, the case the
fragment is for, holds no tab.
This commit is contained in:
Junegunn Choi committed 2026-09-28 05:33:53 +09:00
1 parent 319f5ac437
commit 14f808b543
1 file changed
+2 -2
+2 -2
View File
@@ -561,7 +561,7 @@ endfunction
" a fragment is the cut, and it would match some other line. Running to the end
" of the line it takes any '|' or ';' with it, so it cannot chain a command.
let s:tag_address_part = '\%(\d\+\|/\%(\\.\|[^/\\]\)*/\|?\%(\\.\|[^?\\]\)*?\)'
let s:tag_address_open = '\%(/\%(\\.\|[^/\\]\)*\|?\%(\\.\|[^?\\]\)*\)'
let s:tag_address_open = '\%(/\%(\\.\|[^/\\\t]\)*\|?\%(\\.\|[^?\\\t]\)*\)'
function! s:tag_address(rest, whole)
" :BTags aligns its columns, so its field arrives padded, and a tags file with
" CRLF endings leaves a carriage return, which s:strip() keeps
@@ -575,7 +575,7 @@ function! s:tag_address(rest, whole)
if !empty(address)
return address
endif
return a:whole ? matchstr(rest, '^'.s:tag_address_open.'$') : ''
return a:whole ? matchstr(rest, '^'.s:tag_address_open.'\ze\%(\t\|$\)') : ''
endfunction
" [key, [filename, [stay_on_edit: 0]]]