Fix crash when entering a digit on the SDL keyboard (#8388)

Fixes #8387.
pull/8396/head
zwim 3 years ago committed by GitHub
parent 6aa0d802ec
commit a7cfc65928
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -264,7 +264,7 @@ function Device:init()
self.window.left = ev.value.data1
self.window.top = ev.value.data2
elseif ev.code == SDL_TEXTINPUT then
UIManager:sendEvent(Event:new("TextInput", ev.value))
UIManager:sendEvent(Event:new("TextInput", tostring(ev.value)))
end
end,
hasClipboardText = function()

@ -13,6 +13,7 @@ local TextBoxWidget = require("ui/widget/textboxwidget")
local UIManager = require("ui/uimanager")
local Utf8Proc = require("ffi/utf8proc")
local VerticalGroup = require("ui/widget/verticalgroup")
local dbg = require("dbg")
local util = require("util")
local _ = require("gettext")
local Screen = Device.screen
@ -728,6 +729,11 @@ function InputText:addChars(chars)
self.charpos = self.charpos + #util.splitToChars(chars)
self:initTextBox(table.concat(self.charlist), true)
end
dbg:guard(InputText, "addChars",
function(self, chars)
assert(type(chars) == "string",
"Wrong chars value type (expected string)!")
end)
function InputText:delChar()
if self.readonly or not self:isTextEditable(true) then

Loading…
Cancel
Save