Rewrite the tabs of an address only where it ends in ';"'

Without the terminator nothing says which tab belongs to the pattern and which
separates a column, so a tag command that adds columns without one had its
address merged with them and refused.
This commit is contained in:
Junegunn Choi
2026-09-28 05:33:53 +09:00
parent b268241f4a
commit 319f5ac437
+4 -2
View File
@@ -1655,9 +1655,11 @@ endfunction
" ------------------------------------------------------------------
" ctags leaves a tab inside a pattern as it found it, and splitting the line on
" tabs would cut the address short, leaving a fragment that matches some other
" line. '\t' matches the same text and keeps the field the line's third
" line. '\t' matches the same text and keeps the field the line's third. Only the
" ';"' terminator says where the address ends, so a line without one is left as
" it is rather than guessed at
function! s:tabs_in_address(line)
return substitute(a:line, '^\%([^\t]*\t\)\{2}\zs.\{-}\ze\%(;"\t\|$\)',
return substitute(a:line, '^\%([^\t]*\t\)\{2}\zs.\{-}\ze;"\t',
\ '\=substitute(submatch(0), "\t", ''\\t'', "g")', '')
endfunction