mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
TouchMenu: menu search without patterns (#9884)
See <https://github.com/koreader/koreader/pull/9876#issuecomment-1340090208>.
This commit is contained in:
@@ -1010,7 +1010,7 @@ function TouchMenu:search(search_for)
|
||||
local next_text = text and (text .. "\n" .. indent .. entry_text) or (indent .. entry_text)
|
||||
local next_path = path .. "." .. i
|
||||
recurse(val[i], next_path, next_text, icon, depth)
|
||||
if Utf8Proc.lowercase(entry_text):find(search_for) then
|
||||
if Utf8Proc.lowercase(entry_text):find(search_for, 1, true) then
|
||||
table.insert(found_menu_items, {entry_text, icon, next_path, next_text})
|
||||
end
|
||||
end
|
||||
@@ -1319,18 +1319,10 @@ function TouchMenu:onShowMenuSearch()
|
||||
text = _("Search"),
|
||||
callback = function()
|
||||
local search_for = search_dialog:getInputText()
|
||||
local status, err = pcall( function() ("test_string"):find(search_for) end)
|
||||
if status then
|
||||
search_for = Utf8Proc.lowercase(search_for)
|
||||
G_reader_settings:saveSetting("menu_search_string", search_for)
|
||||
UIManager:close(search_dialog)
|
||||
show_search_results(search_for)
|
||||
else
|
||||
err = err:sub(err:find("lua") + 10) -- 10 = strlen("lua:1165: ")
|
||||
UIManager:show(InfoMessage:new{
|
||||
text = T(_("Malformed message:\n%1"), err)
|
||||
})
|
||||
end
|
||||
search_for = Utf8Proc.lowercase(search_for)
|
||||
G_reader_settings:saveSetting("menu_search_string", search_for)
|
||||
UIManager:close(search_dialog)
|
||||
show_search_results(search_for)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user