Alt arrow keys on numpad transmit extra characters in conhost #21024

Closed
opened 2026-01-31 07:30:57 +00:00 by claunia · 0 comments
Owner

Originally created by @j4james on GitHub (Dec 31, 2023).

Windows Terminal version

Commit 63c3573a13

Windows build number

10.0.19045.3803

Other Software

No response

Steps to reproduce

  1. Open a WSL bash shell in conhost or OpenConsole.
  2. Make sure NumLock is off.
  3. Run showkey -a
  4. Press Alt+RightArrow on the numeric keypad.

Expected Behavior

You should just see the VT escape squence for Alt+RightArrow:

^[[1;3C          27 0033 0x1b
         91 0133 0x5b
         49 0061 0x31
         59 0073 0x3b
         51 0063 0x33
         67 0103 0x43

Actual Behavior

The escape sequence is followed by an extra ♠ character, so it looks like this:

^[[1;3C          27 0033 0x1b
         91 0133 0x5b
         49 0061 0x31
         59 0073 0x3b
         51 0063 0x33
         67 0103 0x43
♠       226 0342 0xe2
        153 0231 0x99
        160 0240 0xa0

The problem is that the combination of the Alt key with a digit on the numeric keyboard causes it to be interpreted as an Alt-Numpad input, in addition to the VT key sequence. So when the Alt key is released, it transmits character 6 (the RightArrow digit) in codepage 437, namely ♠.

This is similar to issue #3101, only that was in Windows Terminal, and I think the underlying cause is possibly different.

Originally created by @j4james on GitHub (Dec 31, 2023). ### Windows Terminal version Commit 63c3573a13cc96bfa3d655f0f1898ae250e2fe35 ### Windows build number 10.0.19045.3803 ### Other Software _No response_ ### Steps to reproduce 1. Open a WSL bash shell in conhost or OpenConsole. 2. Make sure <kbd>NumLock</kbd> is off. 3. Run `showkey -a` 4. Press <kbd>Alt</kbd>+<kbd>RightArrow</kbd> on the numeric keypad. ### Expected Behavior You should just see the VT escape squence for <kbd>Alt</kbd>+<kbd>RightArrow</kbd>: ``` ^[[1;3C 27 0033 0x1b 91 0133 0x5b 49 0061 0x31 59 0073 0x3b 51 0063 0x33 67 0103 0x43 ``` ### Actual Behavior The escape sequence is followed by an extra `♠` character, so it looks like this: ``` ^[[1;3C 27 0033 0x1b 91 0133 0x5b 49 0061 0x31 59 0073 0x3b 51 0063 0x33 67 0103 0x43 ♠ 226 0342 0xe2 153 0231 0x99 160 0240 0xa0 ``` The problem is that the combination of the <kbd>Alt</kbd> key with a digit on the numeric keyboard causes it to be interpreted as an [Alt-Numpad input](https://en.wikipedia.org/wiki/Alt_code), in addition to the VT key sequence. So when the <kbd>Alt</kbd> key is released, it transmits character 6 (the <kbd>RightArrow</kbd> digit) in codepage 437, namely `♠`. This is similar to issue #3101, only that was in Windows Terminal, and I think the underlying cause is possibly different.
claunia added the Help WantedProduct-ConhostIssue-BugIn-PRArea-VTNeeds-Tag-Fix labels 2026-01-31 07:30:58 +00:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#21024