Skip to content

Commit

Permalink
Add an entry for Ctrl-C in DefaultInputMap's SimpleEncoding table
Browse files Browse the repository at this point in the history
  • Loading branch information
rprichard authored and zacps committed Nov 23, 2018
1 parent 7cd5c1d commit a3789e9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/agent/ConsoleInput.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
Expand Down
1 change: 1 addition & 0 deletions src/agent/DefaultInputMap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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 } },
Expand Down

0 comments on commit a3789e9

Please sign in to comment.