fix do not update on save when window is closed
This commit is contained in:
@@ -125,8 +125,10 @@ function M.refresh_tree()
|
|||||||
git.reload_roots()
|
git.reload_roots()
|
||||||
refresh_git(M.Tree)
|
refresh_git(M.Tree)
|
||||||
end
|
end
|
||||||
if M.Tree.winnr ~= nil then
|
if M.win_open() then
|
||||||
renderer.draw(M.Tree, true)
|
renderer.draw(M.Tree, true)
|
||||||
|
else
|
||||||
|
M.Tree.loaded = false
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -165,12 +167,14 @@ function M.set_index_and_redraw(fname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local index = iter(M.Tree.entries)
|
local index = iter(M.Tree.entries)
|
||||||
|
if not M.win_open() then
|
||||||
|
M.Tree.loaded = false
|
||||||
|
return
|
||||||
|
end
|
||||||
renderer.draw(M.Tree, reload)
|
renderer.draw(M.Tree, reload)
|
||||||
if index then
|
if index then
|
||||||
api.nvim_win_set_cursor(M.Tree.winnr, {index, 0})
|
api.nvim_win_set_cursor(M.Tree.winnr, {index, 0})
|
||||||
end
|
end
|
||||||
|
|
||||||
return index
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function M.open_file(mode, filename)
|
function M.open_file(mode, filename)
|
||||||
|
|||||||
@@ -83,7 +83,6 @@ local function is_file_readable(fname)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local function find_file()
|
local function find_file()
|
||||||
if not tree.win_open() then return end
|
|
||||||
local bufname = api.nvim_buf_get_name(api.nvim_get_current_buf())
|
local bufname = api.nvim_buf_get_name(api.nvim_get_current_buf())
|
||||||
if not is_file_readable(bufname) then return end
|
if not is_file_readable(bufname) then return end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user