Fix #7: Pressing return crashes Input.
Add arguments to call of keyboard.pressed() in input.lua. Add sanity check to keyboard.pressed().
This commit is contained in:
parent
ebe0ce2ac0
commit
43265a44ca
2 changed files with 6 additions and 2 deletions
|
@ -63,7 +63,7 @@ return function(w)
|
||||||
-- info
|
-- info
|
||||||
elseif keyboard.key == 'return' then
|
elseif keyboard.key == 'return' then
|
||||||
keyboard.clearFocus()
|
keyboard.clearFocus()
|
||||||
keyboard.pressed()
|
keyboard.pressed('', -1)
|
||||||
elseif keyboard.code >= 32 and keyboard.code < 127 then
|
elseif keyboard.code >= 32 and keyboard.code < 127 then
|
||||||
local left = w.info.text:sub(1,w.info.cursor)
|
local left = w.info.text:sub(1,w.info.cursor)
|
||||||
local right = w.info.text:sub(w.info.cursor+1)
|
local right = w.info.text:sub(w.info.cursor+1)
|
||||||
|
|
|
@ -34,7 +34,11 @@ local cycle = {
|
||||||
next = {key = 'tab'},
|
next = {key = 'tab'},
|
||||||
}
|
}
|
||||||
|
|
||||||
local function pressed(...) key, code = ... end
|
local function pressed(...)
|
||||||
|
key, code = ...
|
||||||
|
assert(type(key) == 'string', 'Invalid argument `key`. Expected string, got ' .. type(key))
|
||||||
|
assert(type(code) == 'number', 'Invalid argument `code`. Expected number, got ' .. type(code))
|
||||||
|
end
|
||||||
local function setFocus(id) focus = id end
|
local function setFocus(id) focus = id end
|
||||||
local function disable() focus = NO_WIDGET end
|
local function disable() focus = NO_WIDGET end
|
||||||
local function clearFocus() focus = nil end
|
local function clearFocus() focus = nil end
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue