Cosmetic changes to names from previous commit

This commit is contained in:
Francesco Abbate 2020-12-26 23:29:18 +01:00
parent ec730e9520
commit 54518c438d
2 changed files with 11 additions and 15 deletions

View File

@ -114,7 +114,7 @@ local function project_scan_thread()
-- different -- different
for i = 1, #core.project_directories do for i = 1, #core.project_directories do
local dir = core.project_directories[i] local dir = core.project_directories[i]
local t, entries_count = get_files(dir.filename) local t, entries_count = get_files(dir.name)
if diff_files(dir.files, t) then if diff_files(dir.files, t) then
if entries_count > config.max_project_files then if entries_count > config.max_project_files then
core.status_view:show_message("!", style.accent, core.status_view:show_message("!", style.accent,
@ -122,7 +122,6 @@ local function project_scan_thread()
config.max_project_files.." files according to config.max_project_files.") config.max_project_files.." files according to config.max_project_files.")
end end
dir.files = t dir.files = t
-- core.project_directories[1] = {filename = system.absolute_path("."), type = "dir"}
core.redraw = true core.redraw = true
end end
end end
@ -255,11 +254,11 @@ function core.init()
core.log_items = {} core.log_items = {}
core.docs = {} core.docs = {}
core.threads = setmetatable({}, { __mode = "k" }) core.threads = setmetatable({}, { __mode = "k" })
local dir_abs_path = system.absolute_path(".") local dir_path = system.absolute_path(".")
core.project_directories = { core.project_directories = {
{ {
filename = dir_abs_path, name = dir_path,
item = {filename = dir_abs_path, type = "dir", top_dir = true}, item = {filename = dir_path, type = "dir", top_dir = true},
files = {}, files = {},
} }
} }

View File

@ -83,16 +83,15 @@ function TreeView:check_cache()
-- invalidate cache's skip values if project_files has changed -- invalidate cache's skip values if project_files has changed
for i = 1, #core.project_directories do for i = 1, #core.project_directories do
local dir = core.project_directories[i] local dir = core.project_directories[i]
local last_files = self.last[dir.filename] local last_files = self.last[dir.name]
if not last_files then if not last_files then
self.last[dir.filename] = dir.files self.last[dir.name] = dir.files
else else
if dir.files ~= last_files then if dir.files ~= last_files then
for _, v in pairs(self.cache[dir.filename]) do for _, v in pairs(self.cache[dir.name]) do
v.skip = nil v.skip = nil
end end
self.last[dir.filename] = dir.files self.last[dir.name] = dir.files
-- self.last_project_files = core.project_files
end end
end end
end end
@ -109,15 +108,13 @@ function TreeView:each_item()
for k = 1, #core.project_directories do for k = 1, #core.project_directories do
local dir = core.project_directories[k] local dir = core.project_directories[k]
local dir_cached = self:get_cached(dir.item, dir.filename) local dir_cached = self:get_cached(dir.item, dir.name)
local dir_name = dir.filename
coroutine.yield(dir_cached, ox, y, w, h) coroutine.yield(dir_cached, ox, y, w, h)
y = y + h y = y + h
local i = 1 local i = 1
while i <= #dir.files do while i <= #dir.files do
local item = dir.files[i] local item = dir.files[i]
-- if belongs_to_directory(item, dir_name) then local cached = self:get_cached(item, dir.name)
local cached = self:get_cached(item, dir_name)
coroutine.yield(cached, ox, y, w, h) coroutine.yield(cached, ox, y, w, h)
y = y + h y = y + h
@ -129,7 +126,7 @@ function TreeView:each_item()
else else
local depth = cached.depth local depth = cached.depth
while i <= #dir.files do while i <= #dir.files do
local filename = relative_filename(dir.files[i].filename, dir_name) local filename = relative_filename(dir.files[i].filename, dir.name)
if get_depth(filename) <= depth then break end if get_depth(filename) <= depth then break end
i = i + 1 i = i + 1
end end