diff options
author | mitchell <70453897+667e-11@users.noreply.github.com> | 2016-08-11 10:11:55 -0400 |
---|---|---|
committer | mitchell <70453897+667e-11@users.noreply.github.com> | 2016-08-11 10:11:55 -0400 |
commit | 1d1259196c1fcfb7daab6c987d13a57672a4f4d6 (patch) | |
tree | 4d7fb817bd27091a9ff14b228686523674915af1 /core/keys.lua | |
parent | 6bc8c3ae2d87758d4777fa170027dbe8cfa14d86 (diff) |
Fixed caps lock key handling.
Diffstat (limited to 'core/keys.lua')
-rw-r--r-- | core/keys.lua | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/core/keys.lua b/core/keys.lua index 6187b466..27ccfa91 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -195,9 +195,13 @@ end -- @param control Whether or not the Control modifier is pressed. -- @param alt Whether or not the Alt/option modifier is pressed. -- @param meta Whether or not the Command modifier on Mac OSX is pressed. +-- @param caps_lock Whether or not Caps Lock is enabled. -- @return `true` to stop handling the key; `nil` otherwise. -local function keypress(code, shift, control, alt, meta) - --print(code, M.KEYSYMS[code], shift, control, alt, meta) +local function keypress(code, shift, control, alt, meta, caps_lock) + --print(code, M.KEYSYMS[code], shift, control, alt, meta, caps_lock) + if caps_lock and (shift or control or alt or meta) and code < 256 then + code = string[shift and 'upper' or 'lower'](string.char(code)):byte() + end local key = code < 256 and (not CURSES or (code ~= 7 and code ~= 13)) and string.char(code) or M.KEYSYMS[code] if not key then return end |