aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/keys.lua8
-rw-r--r--src/textadept.c2
2 files changed, 5 insertions, 5 deletions
diff --git a/core/keys.lua b/core/keys.lua
index fc25b69a..f7c2026e 100644
--- a/core/keys.lua
+++ b/core/keys.lua
@@ -132,8 +132,8 @@ M.LANGUAGE_MODULE_PREFIX = (not OSX and not CURSES and CTRL or META)..'l'
-- @class table
-- @name KEYSYMS
M.KEYSYMS = {
- -- From Scintilla.h and cdk/curdefs.h.
- [7] = 'esc',
+ -- From Scintilla.h.
+ [7] = 'esc', [13] = '\n',
-- From curses.h.
[263] = '\b', [343] = '\n',
-- From Scintilla.h.
@@ -240,8 +240,8 @@ end
-- @return `true` to stop handling the key; `nil` otherwise.
local function keypress(code, shift, control, alt, meta)
--print(code, M.KEYSYMS[code], shift, control, alt, meta)
- local key = code < 256 and (not CURSES or code ~= 7) and string.char(code) or
- M.KEYSYMS[code]
+ local key = code < 256 and (not CURSES or (code ~= 7 and code ~= 13)) and
+ string.char(code) or M.KEYSYMS[code]
if not key then return end
shift = shift and (code >= 256 or code == 9) -- printable chars are uppercased
local key_seq = (control and CTRL or '')..(alt and ALT or '')..
diff --git a/src/textadept.c b/src/textadept.c
index 8d8b1034..f3390dca 100644
--- a/src/textadept.c
+++ b/src/textadept.c
@@ -2367,7 +2367,7 @@ int main(int argc, char **argv) {
#else
TermKeyResult res;
TermKeyKey key;
- int keysyms[] = {0,SCK_BACK,SCK_TAB,'\n',SCK_ESCAPE,0,0,SCK_UP,SCK_DOWN,SCK_LEFT,SCK_RIGHT,0,0,SCK_INSERT,SCK_DELETE,0,SCK_PRIOR,SCK_NEXT,SCK_HOME,SCK_END};
+ int keysyms[] = {0,SCK_BACK,SCK_TAB,SCK_RETURN,SCK_ESCAPE,0,0,SCK_UP,SCK_DOWN,SCK_LEFT,SCK_RIGHT,0,0,SCK_INSERT,SCK_DELETE,0,SCK_PRIOR,SCK_NEXT,SCK_HOME,SCK_END};
while ((res = termkey_waitkey(tk, &key)) != TERMKEY_RES_EOF) {
if (res == TERMKEY_RES_ERROR) continue;
if (key.type == TERMKEY_TYPE_UNICODE)