Reuse s:edit_cmds for a tag in the file already shown

The tag branch edited the file unconditionally, unlike every other kind, so
showing a tag in the window's own buffer reloaded it and reset the undo
history. s:tags_sink does not re-edit either.
This commit is contained in:
Junegunn Choi
2026-08-27 00:02:54 +09:00
parent 05b2324b75
commit a92f1cce23
+2 -2
View File
@@ -723,8 +723,8 @@ function! s:goto_entry(winid, bufnr, dir, kind, entry) abort
if empty(excmd) || !filereadable(path) if empty(excmd) || !filereadable(path)
return return
endif endif
let cmds = ['keepalt keepjumps hide edit '.s:escape(path), let cmds = s:edit_cmds(a:winid, path)
\ 'keepjumps '.excmd, 'normal! ^zvzz'] \ + ['keepjumps '.excmd, 'normal! ^zvzz']
elseif a:kind ==# 'btags' elseif a:kind ==# 'btags'
let parts = split(entry, "\t") let parts = split(entry, "\t")
if len(parts) < 3 || !bufexists(a:bufnr) if len(parts) < 3 || !bufexists(a:bufnr)