Take the carriage return off a tag address

A tags file with CRLF endings and no ';"' terminator, as 'ctags --format=1'
writes on Windows, left a stray CR on the address, and s:strip() counts only
spaces and tabs. Every entry in such a file was refused.
This commit is contained in:
Junegunn Choi
2026-09-28 04:24:49 +09:00
parent 74cab39bbf
commit 81afa1b9d9
+3 -2
View File
@@ -563,8 +563,9 @@ endfunction
let s:tag_address_part = '\%(\d\+\|/\%(\\.\|[^/\\]\)*/\|?\%(\\.\|[^?\\]\)*?\)'
let s:tag_address_open = '\%(/\%(\\.\|[^/\\]\)*\|?\%(\\.\|[^?\\]\)*\)'
function! s:tag_address(rest, whole)
" :BTags aligns its columns, so its field arrives padded
let rest = s:strip(a:rest)
" :BTags aligns its columns, so its field arrives padded, and a tags file with
" CRLF endings leaves a carriage return, which s:strip() keeps
let rest = substitute(a:rest, '^[ \t\r]*\|[ \t\r]*$', '', 'g')
let chain = '^'.s:tag_address_part.'\%(;'.s:tag_address_part.'\)*'
let address = matchstr(rest, chain.'\ze\%(;"\|$\)')
if !empty(address)