Fix "searching" message to display before search begins

master
Jordan Irwin 2021-07-07 19:43:32 -07:00
parent f75eb607e1
commit 7454048aab
4 changed files with 24 additions and 9 deletions

View File

@ -1,3 +1,2 @@
TODO:
- display "searching..." text before search begins, not after

View File

@ -200,13 +200,6 @@ local function formatMatching(player, nlist, params, switches, nocase)
end
end
else
-- FIXME: messages don't display until after list is loaded
if deep_search then
core.chat_send_player(player, "\n" .. S("Searching in names and descriptions ..."))
else
core.chat_send_player(player, "\n" .. S("Searching in names ..."))
end
-- Fill matching list
for i, item in ipairs(nlist) do
local name = item.name

View File

@ -1,4 +1,8 @@
v0.8
----
- fixed "searching" message to display before search begins
v0.7
----
- always register "mobs" type if mobs mod available

View File

@ -96,7 +96,26 @@ local function list(player, l_type, params)
end
end
return listitems.list(player, l_type, switches, params)
local deep_search = true
for _, sw in ipairs(switches) do
if sw == "-s" then
deep_search = false
break
end
end
if deep_search then
core.chat_send_player(player, "\n" .. S("Searching in names and descriptions ..."))
else
core.chat_send_player(player, "\n" .. S("Searching in names ..."))
end
-- let "searching" messages display before executing search
core.after(0, function()
return listitems.list(player, l_type, switches, params)
end)
return true
end