Input dialogs: do not allow blank input cont'd (#7516)

reviewable/pr7529/r1
hius07 3 years ago committed by GitHub
parent 75661abd59
commit 25b40fd1b6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -287,6 +287,7 @@ function InputContainer:onInput(input, ignore_first_hold_release)
text = input.ok_text or _("OK"), text = input.ok_text or _("OK"),
is_enter_default = true, is_enter_default = true,
callback = function() callback = function()
if input.deny_blank_input and self.input_dialog:getInputText() == "" then return end
input.callback(self.input_dialog:getInputText()) input.callback(self.input_dialog:getInputText())
self:closeInputDialog() self:closeInputDialog()
end, end,

@ -433,6 +433,7 @@ function KeyValuePage:init()
hint_func = function() hint_func = function()
return "(" .. "1 - " .. self.pages .. ")" return "(" .. "1 - " .. self.pages .. ")"
end, end,
deny_blank_input = true,
callback = function(input) callback = function(input)
local page = tonumber(input) local page = tonumber(input)
if page and page >= 1 and page <= self.pages then if page and page >= 1 and page <= self.pages then

@ -733,8 +733,8 @@ function Menu:init()
local page = tonumber(self.page_info_text.input_dialog:getInputText()) local page = tonumber(self.page_info_text.input_dialog:getInputText())
if page and page >= 1 and page <= self.page_num then if page and page >= 1 and page <= self.page_num then
self:onGotoPage(page) self:onGotoPage(page)
self.page_info_text:closeInputDialog()
end end
self.page_info_text:closeInputDialog()
end, end,
}, },
}, },
@ -754,6 +754,7 @@ function Menu:init()
--- @todo Support utf8 lowercase. --- @todo Support utf8 lowercase.
local filename = FFIUtil.basename(v.path):lower() local filename = FFIUtil.basename(v.path):lower()
local search_string = self.page_info_text.input_dialog:getInputText():lower() local search_string = self.page_info_text.input_dialog:getInputText():lower()
if search_string == "" then return end
local i, _ = filename:find(search_string) local i, _ = filename:find(search_string)
if i == 1 and not v.is_go_up then if i == 1 and not v.is_go_up then
self:onGotoPage(math.ceil(k / self.perpage)) self:onGotoPage(math.ceil(k / self.perpage))

Loading…
Cancel
Save