wrap refresh logic in vim.schedule callback

This commit is contained in:
kiyan 2020-11-27 22:03:27 +01:00 committed by Kiyan
parent d3eb9cc4c6
commit ba4dac1e59

View File

@ -118,19 +118,22 @@ local function refresh_nodes(node)
end end
function M.refresh_tree() function M.refresh_tree()
-- local stat = luv.fs_stat(M.Tree.cwd) vim.schedule(
-- if stat.mtime.sec ~= M.Tree.last_modified then function ()
refresh_nodes(M.Tree) -- local stat = luv.fs_stat(M.Tree.cwd)
-- end -- if stat.mtime.sec ~= M.Tree.last_modified then
if config.get_icon_state().show_git_icon or vim.g.lua_tree_git_hl then refresh_nodes(M.Tree)
git.reload_roots() -- end
refresh_git(M.Tree) if config.get_icon_state().show_git_icon or vim.g.lua_tree_git_hl then
end git.reload_roots()
if M.win_open() then refresh_git(M.Tree)
renderer.draw(M.Tree, true) end
else if M.win_open() then
M.Tree.loaded = false renderer.draw(M.Tree, true)
end else
M.Tree.loaded = false
end
end)
end end
function M.set_index_and_redraw(fname) function M.set_index_and_redraw(fname)