Implement lazy loading of directories
When the number of files in a project directory is above the max limit switch back to a mechanism to read directory content only when the corresponding folder is expanded in the treeview. When the command core:find-file is invoked the command core:open-file is executed instead because the complete list of the project's files is not available. When a project search is done we search through all the files within the project dir without indexing them. Address issues #217 #203 #183.
This commit is contained in:
@@ -170,12 +170,17 @@ function ResultsView:draw()
|
||||
local ox, oy = self:get_content_offset()
|
||||
local x, y = ox + style.padding.x, oy + style.padding.y
|
||||
local files_number = core.project_files_number()
|
||||
local per = self.last_file_idx / files_number
|
||||
local per = files_number and self.last_file_idx / files_number or 1
|
||||
local text
|
||||
if self.searching then
|
||||
text = string.format("Searching %d%% (%d of %d files, %d matches) for %q...",
|
||||
per * 100, self.last_file_idx, files_number,
|
||||
#self.results, self.query)
|
||||
if files_number then
|
||||
text = string.format("Searching %d%% (%d of %d files, %d matches) for %q...",
|
||||
per * 100, self.last_file_idx, files_number,
|
||||
#self.results, self.query)
|
||||
else
|
||||
text = string.format("Searching (%d files, %d matches) for %q...",
|
||||
self.last_file_idx, #self.results, self.query)
|
||||
end
|
||||
else
|
||||
text = string.format("Found %d matches for %q",
|
||||
#self.results, self.query)
|
||||
|
||||
Reference in New Issue
Block a user