Win32 Input Mode - Quirks and Caveats? #13239
-
Windows Terminal versionNo response Windows build numberNo response Other SoftwareNo response Steps to reproduceWhen sending information from Wezterm to ConPTY it is not, behaving as expected. For example, the case for example of the right control key is not correctly interpreted, it is recognized as the same left control key. more information here: wez/wezterm#2009 and wez/wezterm#1904 Expected BehaviorNo response Actual BehaviorWe expect that ConPTY interpreted the information correctly. For example, the key control left and control right is interpreted independently. |
Beta Was this translation helpful? Give feedback.
Replies: 8 comments 1 reply
-
Important things to note:
wez/wezterm#1509 (comment) has a relatively succinct example of what wezterm is passing to conpty in one problem scenario. I'd love to hear if wezterm should be performing some additional processing on the data that it is serializing for win32 input mode! |
Beta Was this translation helpful? Give feedback.
-
HMM. @wez sorry, I didn't mean to leave you on read! Notification mails for me from projects in the
99 looks familiar, and somewhat unexpected. Also, completely normal and expected.
Now, WT sends What I am at a loss for is two things:
Honestly, it probably shares an origin with how conhost gets these events: window messages. Here's what
There's that ETX again! |
Beta Was this translation helpful? Give feedback.
-
Ah, so [2] above is a result of me reading the code wrong. It is checking for The Realistically, "win32 input mode" is really "what window messages did conhost expect to get?" mode, but... less obvious. |
Beta Was this translation helpful? Give feedback.
-
I figured that it would be something like that; no worries! |
Beta Was this translation helpful? Give feedback.
-
Heh :-) So, right now, wezterm populates that third field with the unicode codepoint that corresponds with the keypress. wezterm doesn't use WM_CHAR messages to figure that out. When CTRL is pressed, should wezterm "normalize" that code point using the normal ctrl mapping logic? eg: uppercase and mask with |
Beta Was this translation helpful? Give feedback.
-
I suspect that we're going to keep finding corner cases; here's the latest one:
I have two questions about this:
|
Beta Was this translation helpful? Give feedback.
-
I'm certain you will! You're the first person to really try to use W32im outside of the limited scope we intended it for. Welcome to the party!¹ The easiest way to figure out what something should generate is to grab a console application that dumps raw input records and see what conhost generates for a given sequence when echokey suggests this for LCtrl+Up:
That 0x100 in
Incidentally, XAML actually gives it to us as well. That's vaguely horrifying: the "modern" UI framework promotes legacy baggage that follows all Win32 developers around into a full, permanent API affordance: if (keyStatus.IsExtendedKey) // this one is theirs
{
modifiers |= ControlKeyStates::EnhancedKey; // this one is ours (in Terminal)
} ¹ Stuff like this is one reason we haven't yet approved it for public consumption. Thanks for being effectively an alpha tester. |
Beta Was this translation helpful? Give feedback.
-
@DHowett wez/wezterm#2127 has another weird case: with a German keyboard layout I can see that this same scenario works with Is there some more magic I need here? :-) |
Beta Was this translation helpful? Give feedback.
Ah, so [2] above is a result of me reading the code wrong. It is checking for
vkey
beingC
, notuchar
beingC
.The
^C
event win32im seems to be expecting isVK=C UC=ETX MODS=CTRL
. I'm comfortable saying that that has its origins in the window messages conhost used to receive.Realistically, "win32 input mode" is really "what window messages did conhost expect to get?" mode, but... less obvious.