restrict input to only valid utf8 bytes

This commit is contained in:
laelnasan
2020-12-05 15:53:51 -03:00
parent 7e0e3809d7
commit 20ca3e6ca2

View File

@@ -97,7 +97,7 @@ function textedit:on_event(e)
self:text_set(self:text() .. pastetext) self:text_set(self:text() .. pastetext)
end end
return true return true
elseif e.key_code > 0x1f and e.key_code < 0x100 then elseif e.key_code > 0x1f and e.key_code < 0xf8 then
self:text_set(self:text() .. string.char(e.key_code)) self:text_set(self:text() .. string.char(e.key_code))
return true return true
end end