Do not try to update topdir folder in treeview

If the directory expanded is a project's top directory
do not attempt to update its content.

Fix again issue #275
This commit is contained in:
Francesco Abbate 2021-06-17 19:07:32 +02:00
parent 4c9083398a
commit 1ad4289e76
2 changed files with 14 additions and 2 deletions

View File

@ -195,6 +195,16 @@ local function project_scan_thread()
end
function core.is_project_folder(dirname)
for _, dir in ipairs(core.project_directories) do
if dir.name == dirname then
return true
end
end
return false
end
function core.scan_project_folder(dirname, filename)
for _, dir in ipairs(core.project_directories) do
if dir.name == dirname then

View File

@ -231,9 +231,11 @@ function TreeView:on_mouse_pressed(button, x, y, clicks)
-- we assume here index is not nil because the abs_filename must contain the
-- relative filename
local dirname = string.sub(abs_filename, 1, index - 2)
if core.is_project_folder(dirname) then
core.scan_project_folder(dirname, filename)
self:invalidate_cache(dirname)
end
end
hovered_item.expanded = not hovered_item.expanded
end
else