aboutsummaryrefslogtreecommitdiff
path: root/core/ext
diff options
context:
space:
mode:
authormitchell <70453897+667e-11@users.noreply.github.com>2010-06-06 18:33:15 -0400
committermitchell <70453897+667e-11@users.noreply.github.com>2010-06-06 18:33:15 -0400
commit7596407f68acb8d63f91e15c591cf415351521ee (patch)
treec49e2303e2831588357ca3e349df83e5a9a1a2eb /core/ext
parent8ab67ae03b55b8718bea4bba638af2994d333c13 (diff)
downloadtextadept-7596407f68acb8d63f91e15c591cf415351521ee.tar.gz
textadept-7596407f68acb8d63f91e15c591cf415351521ee.zip
Made 'KEYSYMS' table a field of core/ext/keys.lua for access.
Diffstat (limited to 'core/ext')
-rw-r--r--core/ext/command_entry.lua5
-rw-r--r--core/ext/keys.lua5
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',