diff options
author | 2011-12-31 16:39:25 -0500 | |
---|---|---|
committer | 2011-12-31 16:39:25 -0500 | |
commit | ae8dddf78ef5b07f4d64471d8f6800746373af6e (patch) | |
tree | 7c823a6df24dbec739559953e1c5d044067e226b /core/keys.lua | |
parent | d9b2bf4b99d13e18f0ca4939e7f2ccc75472a846 (diff) | |
download | textadept-ae8dddf78ef5b07f4d64471d8f6800746373af6e.tar.gz textadept-ae8dddf78ef5b07f4d64471d8f6800746373af6e.zip |
Code cleanup.
Diffstat (limited to 'core/keys.lua')
-rw-r--r-- | core/keys.lua | 19 |
1 files changed, 4 insertions, 15 deletions
diff --git a/core/keys.lua b/core/keys.lua index aacd6560..9a186eed 100644 --- a/core/keys.lua +++ b/core/keys.lua @@ -96,15 +96,10 @@ module('keys')]] -- Therefore, any module containing key commands should be loaded after all -- other modules, whose functions are being referenced, have been loaded. --- settings local ADD = '' -local CTRL = 'c'..ADD -local ALT = 'a'..ADD -local META = 'm'..ADD -local SHIFT = 's'..ADD +local CTRL, ALT, META, SHIFT = 'c'..ADD, 'a'..ADD, 'm'..ADD, 's'..ADD M.CLEAR = 'esc' M.LANGUAGE_MODULE_PREFIX = (not OSX and CTRL or META)..'l' --- end settings -- Optimize for speed. local OSX = OSX @@ -174,10 +169,7 @@ end M.run_command = run_command -- export for menu.lua without creating LuaDoc -- Return codes for `run_key_command()`. -local INVALID = -1 -local PROPAGATE = 0 -local CHAIN = 1 -local HALT = 2 +local INVALID, PROPAGATE, CHAIN, HALT = -1, 0, 1, 2 -- Runs a key command associated with the current keychain. -- @param lexer Optional lexer name for lexer-specific commands. @@ -223,11 +215,8 @@ local function keypress(code, shift, control, alt, meta) key = M.KEYSYMS[code] if not key then return end end - control = control and CTRL or '' - alt = alt and ALT or '' - meta = meta and OSX and META or '' - shift = shift and SHIFT or '' - local key_seq = control..alt..meta..shift..key + local key_seq = (control and CTRL or '')..(alt and ALT or '').. + (meta and OSX and META or '')..(shift and SHIFT or '')..key --print(key_seq) if #keychain > 0 and key_seq == M.CLEAR then |