more bugfixes to file search
This commit is contained in:
parent
4512f67aae
commit
c0e0e3fa0a
16
commands.lua
16
commands.lua
|
@ -776,6 +776,7 @@ function populate_recently_modified_column(column)
|
|||
for line in f:lines() do
|
||||
table.insert(filenames, line)
|
||||
end
|
||||
f:close()
|
||||
local done, ndone = {}, 0
|
||||
for i=#filenames,1,-1 do
|
||||
local filename = filenames[i]
|
||||
|
@ -882,9 +883,11 @@ function resume_search_all()
|
|||
elseif Display_settings.search_all_state.top_level_file_index then
|
||||
local current_filename = Display_settings.search_all_state.top_level_files[Display_settings.search_all_state.top_level_file_index]
|
||||
Display_settings.search_all_progress_indicator = current_filename
|
||||
local info = nativefs.getInfo(Directory..current_filename)
|
||||
if info.type == 'file' then
|
||||
search_in_file(current_filename)
|
||||
if current_filename ~= 'search' and current_filename ~= 'config' and current_filename ~= 'recent' then -- ignore some housekeeping files for pensieve.love
|
||||
local info = nativefs.getInfo(Directory..current_filename)
|
||||
if info.type == 'file' then
|
||||
search_in_file(current_filename)
|
||||
end
|
||||
end
|
||||
Display_settings.search_all_state.top_level_file_index = Display_settings.search_all_state.top_level_file_index+1
|
||||
if Display_settings.search_all_state.top_level_file_index > #Display_settings.search_all_state.top_level_files then
|
||||
|
@ -931,8 +934,12 @@ end
|
|||
|
||||
function search_in_file(filename)
|
||||
--? print('searching '..filename..' for '..Display_settings.search_all_query)
|
||||
local f = App.open_for_reading(Directory..filename)
|
||||
local f, err = App.open_for_reading(Directory..filename)
|
||||
if err then
|
||||
error(err)
|
||||
end
|
||||
local contents = f:read()
|
||||
f:close()
|
||||
if contents == nil then
|
||||
error('no contents in '..filename)
|
||||
end
|
||||
|
@ -1527,6 +1534,7 @@ function command.delete_note()
|
|||
table.insert(filenames, line)
|
||||
end
|
||||
end
|
||||
f:close()
|
||||
local f = App.open_for_writing(Directory..'recent')
|
||||
for _,filename in ipairs(filenames) do
|
||||
f:write(filename)
|
||||
|
|
Loading…
Reference in New Issue
Block a user