aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/keys.lua6
-rw-r--r--modules/textadept/command_entry.lua2
-rw-r--r--modules/textadept/find.lua2
3 files changed, 6 insertions, 4 deletions
diff --git a/core/keys.lua b/core/keys.lua
index 7d2b06a0..9bf86115 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -111,7 +111,9 @@ local error = function(e) events.emit(events.ERROR, e) end
-- @class table
-- @name KEYSYMS
M.KEYSYMS = {
- -- From ncurses.h
+ -- From Scintilla.h and cdk/curdefs.h.
+ [7] = 'esc', [8] = '\b', [9] = '\t', [13] = '\n', [27] = 'esc',
+ -- From ncurses.h.
[263] = '\b',
-- From Scintilla.h.
[300] = 'down', [301] = 'up', [302] = 'left', [303] = 'right',
@@ -224,7 +226,7 @@ local function keypress(code, shift, control, alt, meta)
local key
--print(code, M.KEYSYMS[code], shift, control, alt, meta)
if code < 256 then
- key = (not NCURSES or code ~= 7) and string_char(code) or 'esc'
+ key = (not NCURSES or code ~= 7) and string_char(code) or M.KEYSYMS[code]
shift = shift and code < 32 -- for printable characters, key is upper case
else
key = M.KEYSYMS[code]
diff --git a/modules/textadept/command_entry.lua b/modules/textadept/command_entry.lua
index 149c37c8..225b1330 100644
--- a/modules/textadept/command_entry.lua
+++ b/modules/textadept/command_entry.lua
@@ -43,7 +43,7 @@ end)
events.connect(events.COMMAND_ENTRY_KEYPRESS, function(code)
if keys.KEYSYMS[code] == 'esc' then
gui.command_entry.focus() -- toggle focus to hide
- elseif not NCURSES and keys.KEYSYMS[code] == '\t' or code == 9 then
+ elseif keys.KEYSYMS[code] == '\t' then
local substring = gui.command_entry.entry_text:match('[%w_.:]+$') or ''
local path, o, prefix = substring:match('^([%w_.:]-)([.:]?)([%w_]*)$')
local f, err = load('return ('..path..')', nil, 'bt', env)
diff --git a/modules/textadept/find.lua b/modules/textadept/find.lua
index ade3fd1b..9944076c 100644
--- a/modules/textadept/find.lua
+++ b/modules/textadept/find.lua
@@ -248,7 +248,7 @@ end
events_connect(events.COMMAND_ENTRY_KEYPRESS, function(code)
if not find.incremental then return end
- if not NCURSES and keys.KEYSYMS[code] == 'esc' or code == 27 then
+ if keys.KEYSYMS[code] == 'esc' then
find.incremental = nil
elseif keys.KEYSYMS[code] == '\b' then
find_incremental(gui.command_entry.entry_text:sub(1, -2))