aboutsummaryrefslogtreecommitdiff
path: root/core/keys.lua
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2011-12-31 16:39:25 -0500
committermitchell <70453897+667e-11@users.noreply.github.com>2011-12-31 16:39:25 -0500
commitae8dddf78ef5b07f4d64471d8f6800746373af6e (patch)
tree7c823a6df24dbec739559953e1c5d044067e226b /core/keys.lua
parentd9b2bf4b99d13e18f0ca4939e7f2ccc75472a846 (diff)
downloadtextadept-ae8dddf78ef5b07f4d64471d8f6800746373af6e.tar.gz
textadept-ae8dddf78ef5b07f4d64471d8f6800746373af6e.zip
Code cleanup.
Diffstat (limited to 'core/keys.lua')
-rw-r--r--core/keys.lua19
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