[UX] Search dialogs: don't close when searching with nothing entered (#7501)

File search, Fulltext search, Search dictionary, Search Wikipedia, DictQuickLookup: do nothing when nothing entered and search is pressed.
This commit is contained in:
hius07
2021-04-04 18:27:17 +03:00
committed by GitHub
parent 10922561dd
commit aef1e271b5
5 changed files with 26 additions and 39 deletions

View File

@@ -50,6 +50,7 @@ function ReaderSearch:onShowFulltextSearchInput()
{
text = backward_text,
callback = function()
if self.input_dialog:getInputText() == "" then return end
UIManager:close(self.input_dialog)
self:onShowSearchDialog(self.input_dialog:getInputText(), 1)
end,
@@ -58,6 +59,7 @@ function ReaderSearch:onShowFulltextSearchInput()
text = forward_text,
is_enter_default = true,
callback = function()
if self.input_dialog:getInputText() == "" then return end
UIManager:close(self.input_dialog)
self:onShowSearchDialog(self.input_dialog:getInputText(), 0)
end,
@@ -212,7 +214,6 @@ end
function ReaderSearch:search(pattern, origin)
logger.dbg("search pattern", pattern)
if pattern == nil or pattern == '' then return end
local direction = self.direction
local case = self.case_insensitive
local page = self.view.state.page