From 59d57ba47bdda8e7908892f806e70caaea1abafa Mon Sep 17 00:00:00 2001 From: mitchell <70453897+667e-11@users.noreply.github.com> Date: Tue, 27 Nov 2018 16:37:16 -0500 Subject: Fixed Alt+Gr key handling in the Windows terminal version. --- modules/textadept/keys.lua | 1 + src/termkey.patch | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/textadept/keys.lua b/modules/textadept/keys.lua index 61ebdfdb..f27044e8 100644 --- a/modules/textadept/keys.lua +++ b/modules/textadept/keys.lua @@ -257,6 +257,7 @@ module('textadept.keys')]] -- For pdcurses (Win32): -- * Control+Shift+Letter keys are not recognized. Other Control+Shift keys -- are. +-- * Ctrl+Meta+Symbol keys are not recognized. -- -- Unassigned keys (~ denotes keys reserved by the operating system): -- c: g~~ ~ ~ diff --git a/src/termkey.patch b/src/termkey.patch index 6fdb3597..df5073dc 100644 --- a/src/termkey.patch +++ b/src/termkey.patch @@ -1,7 +1,7 @@ diff -r 49c8684413c0 driver-win32-pdcurses.c --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/driver-win32-pdcurses.c Tue Dec 23 13:31:50 2014 -0500 -@@ -0,0 +1,106 @@ +@@ -0,0 +1,108 @@ +// Copyright 2014-2018 Mitchell mitchell.att.foicica.com. See LICENSE. + +#include "termkey.h" @@ -58,10 +58,12 @@ diff -r 49c8684413c0 driver-win32-pdcurses.c + alt = PDC_get_key_modifiers() & PDC_KEY_MODIFIER_ALT; + // Do not shift printable keys. + if (shift && codepoint >= 32 && codepoint <= 127) shift = 0; ++ // Alt+Gr maps to Ctrl+Alt; assume non-ascii-letter chars are composed. ++ if (ctrl && alt && (codepoint < 'a' || codepoint > 'z')) ctrl = 0, alt = 0; + key->type = type; + if (type == TERMKEY_TYPE_UNICODE) { + key->code.codepoint = codepoint; -+ key->utf8[0] = key->code.codepoint, key->utf8[1] = '\0'; ++ key->utf8[0] = key->code.codepoint, key->utf8[1] = '\0'; // unused + } else if (type == TERMKEY_TYPE_FUNCTION) + key->code.number = number; + else if (type == TERMKEY_TYPE_KEYSYM) -- cgit v1.2.3