Skip to content

Commit

Permalink
Mark ESC as handled so that it doesn't come back in CharacterHandler (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
DHowett committed Jul 16, 2019
1 parent fa5b9b0 commit a0782bf
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/cascadia/TerminalCore/Terminal.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,14 @@ bool Terminal::SendKeyEvent(const WORD vkey, const ControlKeyStates states)
}
}

// Manually handle Escape here. If we let it fall through, it'll come
// back up through the character handler. It's registered as a translation
// in TerminalInput, so we'll let TerminalInput control it.
if (vkey == VK_ESCAPE)
{
ch = UNICODE_ESC;
}

const bool manuallyHandled = ch != UNICODE_NULL;

KeyEvent keyEv{ true, 0, vkey, 0, ch, states.Value() };
Expand Down
1 change: 1 addition & 0 deletions src/inc/unicode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Author(s):

// UNICODE_NULL is a Windows macro definition
const wchar_t UNICODE_BACKSPACE = 0x8;
const wchar_t UNICODE_ESC = 0x1b;
const wchar_t UNICODE_DEL = 0x7f;
// NOTE: This isn't actually a backspace. It's a graphical block. But
// I believe it's emitted by one of our ANSI/OEM --> Unicode conversions.
Expand Down

0 comments on commit a0782bf

Please sign in to comment.