Add an entry for Ctrl-C in DefaultInputMap's SimpleEncoding table

Fixes https://github.com/rprichard/winpty/issues/116
This commit is contained in:
Ryan Prichard 2017-05-18 04:20:36 -05:00
parent c9ce3ad1e3
commit 0c86e4f78e
2 changed files with 9 additions and 1 deletions

View File

@ -375,7 +375,14 @@ int ConsoleInput::scanInput(std::vector<INPUT_RECORD> &records,
{
ASSERT(inputSize >= 1);
// Ctrl-C.
// Ctrl-C. We need to use window messages when the console is in
// ENABLE_PROCESSED_INPUT mode so that Ctrl-C interrupts a ReadConsole
// call. In unprocessed mode, we can't use this code path, because it
// would produce a KEY_EVENT_RECORD with a NUL UnicodeChar. We can't use
// the ordinary VkKeyScan code path for Ctrl-C, either, because it produces
// an unmodified VK_CANCEL. Instead, there's an entry for Ctrl-C in the
// SimpleEncoding table in DefaultInputMap.
// See https://github.com/rprichard/winpty/issues/116.
if (input[0] == '\x03' && (inputConsoleMode() & ENABLE_PROCESSED_INPUT)) {
flushInputRecords(records);
trace("Sending Ctrl-C KEYDOWN/KEYUP messages");

View File

@ -235,6 +235,7 @@ static void addSimpleEntries(InputMap &inputMap) {
{ "\x7F", { VK_BACK, '\x08', 0, } },
{ ESC "\x7F", { VK_BACK, '\x08', LEFT_ALT_PRESSED, } },
{ "\x03", { 'C', '\x03', LEFT_CTRL_PRESSED, } },
// Handle special F1-F5 for TERM=linux and TERM=cygwin.
{ ESC "[[A", { VK_F1, '\0', 0 } },