From ae8dddf78ef5b07f4d64471d8f6800746373af6e Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Sat, 31 Dec 2011 16:39:25 -0500 Subject: Code cleanup. --- core/keys.lua | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) (limited to 'core/keys.lua') 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 -- cgit v1.2.3