aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrancesco Abbate <francesco.bbt@gmail.com>2021-12-29 17:12:01 +0100
committerFrancesco Abbate <francesco.bbt@gmail.com>2021-12-29 17:12:01 +0100
commit3713f6d56a026e741f0a6eee2e261621cfc23ad2 (patch)
tree851235dee71efaa66dbbc076bb3e1439984a2df5
parentb169d9ef8fa50ad90a3709023b79cc761f97af6b (diff)
downloadlite-xl-3713f6d56a026e741f0a6eee2e261621cfc23ad2.tar.gz
lite-xl-3713f6d56a026e741f0a6eee2e261621cfc23ad2.zip
Fix some logical errors with previous commit
We need to replay "treeview expand directory" operations to update the files list, in rescan_project_directories, only in files_limit mode. When a folder is expanded in TreeView we update the project directories to add the folder's files only based on files_limit.
-rw-r--r--data/core/init.lua17
-rw-r--r--data/plugins/treeview.lua2
2 files changed, 11 insertions, 8 deletions
diff --git a/data/core/init.lua b/data/core/init.lua
index 3c9d8d95..db30c929 100644
--- a/data/core/init.lua
+++ b/data/core/init.lua
@@ -411,13 +411,16 @@ 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.
- 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 above match when happens in TreeView:on_mouse_pressed
- core.update_project_subdir(dir, subdir, show)
- core.project_subdir_set_show(dir, subdir, show)
- break
+ if dir.files_limit 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)
+ core.project_subdir_set_show(dir, subdir, show)
+ break
+ end
end
end
end
diff --git a/data/plugins/treeview.lua b/data/plugins/treeview.lua
index 49c57f0e..ffe93ca5 100644
--- a/data/plugins/treeview.lua
+++ b/data/plugins/treeview.lua
@@ -232,7 +232,7 @@ 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 not hovered_dir.watch_recursive then
+ if hovered_dir and hovered_dir.files_limit then
core.update_project_subdir(hovered_dir, hovered_item.filename, hovered_item.expanded)
core.project_subdir_set_show(hovered_dir, hovered_item.filename, hovered_item.expanded)
end