Leave the cursor alone when no tag was opened

Refusing the address of a single selected tag leaves the quickfix list empty,
and 'normal! ^zvzz' then moved the cursor in whatever buffer the user was in.
This commit is contained in:
Junegunn Choi
2026-09-28 03:36:17 +09:00
parent 747cd594a2
commit 0ce4cca7bd
+3 -2
View File
@@ -547,6 +547,7 @@ function! s:sandboxed(cmd)
return 'sandbox execute '.string(a:cmd)
endfunction
" Address of a tag, given the rest of the line after the file name, or, with
" 'whole' off, the address field alone as :BTags reads it. Only the forms a tags
" file is meant to hold, a line number and a search pattern, chained with ';' for
@@ -1735,7 +1736,7 @@ function! s:btags_sink(from, lines)
normal! g`'
" Because 'listproc' will use 'cfirst' to go to the first item in the list
call s:fill_quickfix('btags', qfl)
else
elseif len(qfl) == 1
normal! zvzz
endif
if !empty(tagname)
@@ -1835,7 +1836,7 @@ function! s:tags_sink(from, lines)
call s:action_for(key, qfl[0].filename, 1)
call s:fill_quickfix('tags', qfl)
else
elseif len(qfl) == 1
normal! ^zvzz
endif
if !empty(tagname)