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
for i = 1, #core.project_directories do
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 entries_count > config.max_project_files then
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.")
end
dir.files = t
-- core.project_directories[1] = {filename = system.absolute_path("."), type = "dir"}
core.redraw = true
end
end
@ -255,11 +254,11 @@ function core.init()
core.log_items = {}
core.docs = {}
core.threads = setmetatable({}, { __mode = "k" })
local dir_abs_path = system.absolute_path(".")
local dir_path = system.absolute_path(".")
core.project_directories = {
{
filename = dir_abs_path,
item = {filename = dir_abs_path, type = "dir", top_dir = true},
name = dir_path,
item = {filename = dir_path, type = "dir", top_dir = true},
files = {},
}
}

View File

@ -83,16 +83,15 @@ function TreeView:check_cache()
-- invalidate cache's skip values if project_files has changed
for i = 1, #core.project_directories do
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
self.last[dir.filename] = dir.files
self.last[dir.name] = dir.files
else
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
end
self.last[dir.filename] = dir.files
-- self.last_project_files = core.project_files
self.last[dir.name] = dir.files
end
end
end
@ -109,15 +108,13 @@ function TreeView:each_item()
for k = 1, #core.project_directories do
local dir = core.project_directories[k]
local dir_cached = self:get_cached(dir.item, dir.filename)
local dir_name = dir.filename
local dir_cached = self:get_cached(dir.item, dir.name)
coroutine.yield(dir_cached, ox, y, w, h)
y = y + h
local i = 1
while i <= #dir.files do
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)
y = y + h
@ -129,7 +126,7 @@ function TreeView:each_item()
else
local depth = cached.depth
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
i = i + 1
end