aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-12-30 00:05:58 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-12-30 00:05:58 +0100
commitde2ff9effec865839fdc14a9a1c3e320e3a20535 (patch)
tree7532989d15f897f88fbe69bfd2e8a7c02c06cd84
parent264ca6178ae4f1373ea4e8104e40096a37910a9d (diff)
downloadlite-xl-de2ff9effec865839fdc14a9a1c3e320e3a20535.tar.gz
lite-xl-de2ff9effec865839fdc14a9a1c3e320e3a20535.zip
Fix logical error with non-recursive watch
-rw-r--r--data/core/init.lua8
-rw-r--r--data/plugins/treeview.lua6
2 files changed, 9 insertions, 5 deletions
diff --git a/data/core/init.lua b/data/core/init.lua
index 6a41cc9e..57ef50e4 100644
--- a/data/core/init.lua
+++ b/data/core/init.lua
@@ -389,13 +389,15 @@ local function rescan_project_directories()
local dir = core.add_project_directory(save_project_dirs[i].name)
-- The shown_subdir is only used on linux for very large directories.
-- replay them on the newly scanned project.
- if dir.files_limit then
+ if dir.files_limit or not dir.watch_recursive then
for subdir, show in pairs(save_project_dirs[i].shown_subdir) do
for j = 1, #dir.files do
if dir.files[j].filename == subdir then
-- The instructions below match when happens in TreeView:on_mouse_pressed.
-- We perform the operations only once iff the subdir is in dir.files.
- core.update_project_subdir(dir, subdir, show)
+ if dir.files_limit then
+ core.update_project_subdir(dir, subdir, show)
+ end
core.project_subdir_set_show(dir, subdir, show)
break
end
@@ -515,7 +517,7 @@ local function project_scan_remove_file(dir, filepath)
local index, match = file_search(dir.files, fileinfo)
if match then
table.remove(dir.files, index)
- if filetype == "dir" and dir.files_limit then
+ if filetype == "dir" and (dir.files_limit or not dir.watch_recursive) then
dir.shown_subdir[filepath] = nil
end
dir.is_dirty = true
diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua
index ffe93ca5..7d921f91 100644
--- a/data/plugins/treeview.lua
+++ b/data/plugins/treeview.lua
@@ -232,8 +232,10 @@ function TreeView:on_mouse_pressed(button, x, y, clicks)
else
hovered_item.expanded = not hovered_item.expanded
local hovered_dir = core.project_dir_by_name(hovered_item.dir_name)
- if hovered_dir and hovered_dir.files_limit then
- core.update_project_subdir(hovered_dir, hovered_item.filename, hovered_item.expanded)
+ if hovered_dir and (hovered_dir.files_limit or not hovered_dir.watch_recursive) then
+ if hovered_dir.files_limit then
+ core.update_project_subdir(hovered_dir, hovered_item.filename, hovered_item.expanded)
+ end
core.project_subdir_set_show(hovered_dir, hovered_item.filename, hovered_item.expanded)
end
end