Fix Shift-Alt-O and Alt-[.

* ^[O is Shift-Alt-O, not Alt-O.  Alt-O is ^[o

 * '[' is not a valid virtualkey.  It's typically VK_OEM_4 on a US
   keyboard, but it needs to be looked up dynamically.

 * The unicodeChar fields should be 'O' and '[', not NUL.
This commit is contained in:
Ryan Prichard 2015-12-01 05:03:58 -06:00
parent c60f748fb3
commit 08a14e7ddd
2 changed files with 4 additions and 2 deletions

View File

@ -6,6 +6,7 @@
* For debugging, added a --showkey option to the unix adapter and a
WINPTY_DEBUG=input option for logging both input bytes and synthesized
console keyboard events.
* Fixed handling of Shift-Alt-O and Alt-[.
# Version 0.2.0 (2015-11-13)

View File

@ -50,6 +50,7 @@ ConsoleInput::ConsoleInput(DsrSender *dsrSender) :
const char *encoding;
InputMap::Key key;
};
const int vkLB = VkKeyScan('[') & 0xFF;
static const KeyDescriptor keyDescriptorTable[] = {
// Ctrl-<letter/digit> seems to be handled OK by the default code path.
// TODO: Alt-ESC is encoded as ESC ESC. Can it be handled?
@ -57,8 +58,8 @@ ConsoleInput::ConsoleInput(DsrSender *dsrSender) :
{ ESC, { VK_ESCAPE, '\x1B', 0, } },
// Alt-<letter/digit>
{ ESC"O", { 'O', '\0', LEFT_ALT_PRESSED } },
{ ESC"[", { '[', '\0', LEFT_ALT_PRESSED } },
{ ESC"O", { 'O', 'O', LEFT_ALT_PRESSED | SHIFT_PRESSED } },
{ ESC"[", { vkLB, '[', LEFT_ALT_PRESSED } },
// F1-F4 function keys. F5-F12 seem to be handled more consistently among
// various TERM=xterm terminals (gnome-terminal, konsole, xterm, mintty),