[bug] undotree become empty
" $ uname -r
" 5.13.13-arch1-1
" $ has nvim
" ✓ nvim 0.5.0
" $ cat test.vim
set runtimepath=$VIMRUNTIME
set runtimepath+=~/.local/share/nvim/repos/github.com/mbbill/undotree
set undofile
autocmd VimEnter * UndotreeShow
" $ vi -u test.vim one_file_has_undo_histories.

Press <C-w>o

Press :UndotreeShow<CR>

The undotree is empty!
the tree should show up once you move the focus to the right side
the tree should show up once you move the focus to the right side
Thanks.
When I UndotreeShow firstly, the cursor is in the current buffer and the
undotree display. However, when I UndotreeShow secondly, the cursor moves to
the undotree buffer? This is why?
I'm not exactly sure, but I guess it might be related to how VIM handles the 'previous window'.
So it is a bug of (n)vim? 😄
Also, experiencing this bug.
Closing undotree window with q shows no bug. However closing undotree with :q or ZQ shows this behavior.
So it is a bug of (n)vim? 😄
@Freed-Wu: I can replicate it in vim 8.1
@RayZ0rr: Good catch!
I made this hack in lua for neovim as a workaround:
local function enter_undotree()
vim.api.nvim_command('UndotreeShow')
local is_glitched = vim.fn.getreg('%') == 'undotree_2'
if is_glitched then
vim.api.nvim_command [[
wincmd w
wincmd w
wincmd p
]]
else
vim.api.nvim_command('UndotreeFocus')
end
end