Fix behavior when selecting project directories

This commit is contained in:
Francesco Abbate
2021-01-03 15:35:35 +01:00
parent e548a6adb9
commit 8d4ba0cb34
2 changed files with 28 additions and 20 deletions
+18
View File
@@ -82,6 +82,24 @@ function common.fuzzy_match(haystack, needle)
end
function common.fuzzy_match_with_recents(haystack, recents, needle)
if needle == "" then
local recents_ext = {}
for i = 2, #recents do
table.insert(recents_ext, recents[i])
end
table.insert(recents_ext, recents[1])
local others = common.fuzzy_match(haystack, "")
for i = 1, #others do
table.insert(recents_ext, others[i])
end
return recents_ext
else
return fuzzy_match_items(haystack, needle)
end
end
function common.path_suggest(text)
local path, name = text:match("^(.-)([^/\\]*)$")
local files = system.list_dir(path == "" and "." or path) or {}