fix(#1503): focus last win before close (#1509)

This commit is contained in:
Alexander Courtis 2022-08-20 14:32:28 +10:00 committed by GitHub
parent 09a51266bc
commit d9edddb849
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -188,11 +188,11 @@ function M.close()
local current_win = a.nvim_get_current_win()
for _, win in pairs(a.nvim_list_wins()) do
if tree_win ~= win and a.nvim_win_get_config(win).relative == "" then
a.nvim_win_close(tree_win, true)
local prev_win = vim.fn.winnr "#" -- this tab only
if tree_win == current_win and prev_win > 0 then
a.nvim_set_current_win(vim.fn.win_getid(prev_win))
end
a.nvim_win_close(tree_win, true)
events._dispatch_on_tree_close()
return
end