microsoft / terminal

The new Windows Terminal and the original Windows console host, all in the same place!
MIT License
95.27k stars 8.27k forks source link

Support multi-code-point characters in TerminalInput::HandleKey #2853

Open lhecker opened 5 years ago

lhecker commented 5 years ago

Description of the new feature/enhancement

Starting with #2836 key events containing combinations like Shift. (here: US keyboard layout) will be mapped to their matching, potentially non-ASCII, counterparts (here: >). This is achieved using the ToUnicodeEx method.

But this leads to a problem: ToUnicodeEx can potentially return multiple code points. TerminalInput::HandleKey and its KeyEvent parameter only accept a single code point though.

👉 TerminalInput and KeyEvent should be modified to accommodate multi-code-point characters (i.e. e.g. by replacing wchar_t with std::wstring).

DHowett-MSFT commented 5 years ago

This is good and righteous work that needs a design -- a lot of the key input stuff that comes through TerminalInput is that way for compatibility with the ReadConsoleInput API. That API can only transit WCHARs :smile: