mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Fix crash when entering a digit on the SDL keyboard (#8388)
Fixes #8387.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user