diff options
Diffstat (limited to 'core/ext')
-rw-r--r-- | core/ext/command_entry.lua | 5 | ||||
-rw-r--r-- | core/ext/keys.lua | 5 |
2 files changed, 7 insertions, 3 deletions
diff --git a/core/ext/command_entry.lua b/core/ext/command_entry.lua index d35a8f49..34dfbe13 100644 --- a/core/ext/command_entry.lua +++ b/core/ext/command_entry.lua @@ -14,10 +14,11 @@ textadept.events.add_handler('command_entry_command', textadept.events.add_handler('command_entry_keypress', function(code) local ce = textadept.command_entry - if code == 0xff1b then -- escape + local KEYSYMS = textadept.keys.KEYSYMS + if KEYSYMS[code] == 'esc' then ce.focus() -- toggle focus to hide return true - elseif code == 0xff09 then -- tab + elseif KEYSYMS[code] == '\t' then local substring = ce.entry_text:match('[%w_.:]+$') or '' local path, o, prefix = substring:match('^([%w_.:]-)([.:]?)([%w_]*)$') local ret, tbl = pcall(loadstring('return ('..path..')')) diff --git a/core/ext/keys.lua b/core/ext/keys.lua index 72e9294c..e5066f17 100644 --- a/core/ext/keys.lua +++ b/core/ext/keys.lua @@ -47,10 +47,13 @@ local type = _G.type local unpack = _G.unpack local MAC = _G.MAC +--- -- Lookup table for key values higher than 255. -- If a key value given to 'keypress' is higher than 255, this table is used to -- return a string representation of the key if it exists. -local KEYSYMS = { -- from <gdk/gdkkeysyms.h> +-- @class table +-- @name KEYSYMS +KEYSYMS = { -- from <gdk/gdkkeysyms.h> [65056] = '\t', -- backtab; will be 'shift'ed [65288] = '\b', [65289] = '\t', |