Skip to content

Commit

Permalink
Ignore arrow keys from text input
Browse files Browse the repository at this point in the history
  • Loading branch information
britzl committed Dec 9, 2017
1 parent 9e0fb51 commit 0b2b25f
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions gooey/gooey.lua
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,17 @@ function M.input(node_id, keyboard_type, action_id, action, config)
if input.selected then
-- new raw text input
if action_id == M.TEXT then
input.text = input.text .. action.text
if config and config.max_length then
input.text = input.text:sub(1, config.max_length)
local hex = string.gsub(action.text,"(.)", function (c)
return string.format("%02X%s",string.byte(c), "")
end)
-- ignore arrow keys
if not string.match(hex, "EF9C8[0-3]") then
input.text = input.text .. action.text
if config and config.max_length then
input.text = input.text:sub(1, config.max_length)
end
input.marked_text = ""
end
input.marked_text = ""
-- new marked text input (uncommitted text)
elseif action_id == M.MARKEDTEXT then
input.marked_text = action.text or ""
Expand Down

0 comments on commit 0b2b25f

Please sign in to comment.