Numpad shortcuts with both Ctrl and Shift don't work #4187

Closed
opened 2026-01-30 23:40:28 +00:00 by claunia · 8 comments
Owner

Originally created by @jimjam-slam on GitHub (Oct 1, 2019).

Environment

Windows build number: 10.0.18362.0
Windows Terminal version (if applicable): 0.5.2681.0

Any other software? No

Steps to reproduce

Set the newTabProfile0 shortcut to "Ctrl+numpad_1" and save:

{
    "command" : "newTabProfile0",
    "keys" : 
    [
        "ctrl+numpad_1"
    ]
},

Test the shortcut to verify that it works as expected (a new terminal tab opens as expected, regardless of which shell was currently active before).

Reopen settings; change this shortcut to "ctrl+shift+numpad_1" and save. Try to use shortcut.

Expected behavior

A new terminal tab to be opened with the appropriate profile:

image

Actual behavior

Depends on the currently active shell. If it's Powershell or cmd, nothing. If it's Bash WSL, ";5F" appears following the prompt:

image

(Found this issue while testing https://github.com/microsoft/terminal/issues/2628; nto sure if it's also related to https://github.com/microsoft/terminal/issues/2967 or if I'm just incorrectly stating the shortcut?)

Originally created by @jimjam-slam on GitHub (Oct 1, 2019). <!-- 🚨🚨🚨🚨🚨🚨🚨🚨🚨🚨 I ACKNOWLEDGE THE FOLLOWING BEFORE PROCEEDING: 1. If I delete this entire template and go my own path, the core team may close my issue without further explanation or engagement. 2. If I list multiple bugs/concerns in this one issue, the core team may close my issue without further explanation or engagement. 3. If I write an issue that has many duplicates, the core team may close my issue without further explanation or engagement (and without necessarily spending time to find the exact duplicate ID number). 4. If I leave the title incomplete when filing the issue, the core team may close my issue without further explanation or engagement. 5. If I file something completely blank in the body, the core team may close my issue without further explanation or engagement. All good? Then proceed! --> <!-- This bug tracker is monitored by Windows Terminal development team and other technical folks. **Important: When reporting BSODs or security issues, DO NOT attach memory dumps, logs, or traces to Github issues**. Instead, send dumps/traces to secure@microsoft.com, referencing this GitHub issue. If this is an application crash, please also provide a Feedback Hub submission link so we can find your diagnostic data on the backend. Use the category "Apps > Windows Terminal (Preview)" and choose "Share My Feedback" after submission to get the link. Please use this form and describe your issue, concisely but precisely, with as much detail as possible. --> # Environment ```none Windows build number: 10.0.18362.0 Windows Terminal version (if applicable): 0.5.2681.0 Any other software? No ``` # Steps to reproduce Set the `newTabProfile0` shortcut to `"Ctrl+numpad_1"` and save: ``` { "command" : "newTabProfile0", "keys" : [ "ctrl+numpad_1" ] }, ``` Test the shortcut to verify that it works as expected (a new terminal tab opens as expected, regardless of which shell was currently active before). Reopen settings; change this shortcut to `"ctrl+shift+numpad_1"` and save. Try to use shortcut. # Expected behavior A new terminal tab to be opened with the appropriate profile: ![image](https://user-images.githubusercontent.com/6520659/65925248-53171f00-e433-11e9-9a9a-bb84c1579a3b.png) # Actual behavior Depends on the currently active shell. If it's Powershell or cmd, nothing. If it's Bash WSL, `";5F"` appears following the prompt: ![image](https://user-images.githubusercontent.com/6520659/65925294-8fe31600-e433-11e9-8d04-36b3520ea05f.png) (Found this issue while testing https://github.com/microsoft/terminal/issues/2628; nto sure if it's also related to https://github.com/microsoft/terminal/issues/2967 or if I'm just incorrectly stating the shortcut?)
Author
Owner

@jimjam-slam commented on GitHub (Oct 1, 2019):

I should note that the default shortcuts, which use the top row numbers rather than the numpad (eg. "ctrl+shift+1", work fine, as do other shortcuts that use Ctrl and Shift, like the default "openNewTabDropdown", which is "ctrl_shift+space" 🙂

@jimjam-slam commented on GitHub (Oct 1, 2019): I should note that the default shortcuts, which use the top row numbers rather than the numpad (eg. `"ctrl+shift+1"`, work fine, as do other shortcuts that use Ctrl and Shift, like the default `"openNewTabDropdown"`, which is `"ctrl_shift+space"` 🙂
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 23, 2019):

That's really interesting. I wonder if they come through as arrow keys?

I don't have a numpad on my keyboard, but would you mind running xxd in wsl and seeing the full sequence that it emits?

Thanks!

@DHowett-MSFT commented on GitHub (Oct 23, 2019): That's really interesting. I wonder if they come through as arrow keys? I don't have a numpad on my keyboard, but would you mind running `xxd` in wsl and seeing the full sequence that it emits? Thanks!
Author
Owner

@jimjam-slam commented on GitHub (Oct 23, 2019):

Sorry @DHowett, I haven't used xxd before. Are you asking me to run that command and then test typing in keyboard shortcuts like Ctrl+shift+_numpad1 and observing the output emitted when I type them? Just running it on its own seems to leave it waiting until I kill it.

I might not be fuly test this until next week, as I'm away from an external keyboard myself (travelling with a laptop).

Interestingly, I currently have the new tabs configured as Ctrl+_numpadX (_numpadX being a numpad key) at the moment (which works, as expected), but Ctrl+Shift+X (X being the corresponding top row number key) also seems to work. Not sure if that's because it's the default and isn't being unbound or because it's intended that the defaults continue to work even after remapping.

@jimjam-slam commented on GitHub (Oct 23, 2019): Sorry @DHowett, I haven't used `xxd` before. Are you asking me to run that command and then test typing in keyboard shortcuts like `Ctrl+shift+_numpad1` and observing the output emitted when I type them? Just running it on its own seems to leave it waiting until I kill it. I might not be fuly test this until next week, as I'm away from an external keyboard myself (travelling with a laptop). Interestingly, I currently have the new tabs configured as `Ctrl+_numpadX` (`_numpadX` being a numpad key) at the moment (which works, as expected), but `Ctrl+Shift+X` (`X` being the corresponding top row number key) also seems to work. Not sure if that's because it's the default and isn't being unbound or because it's intended that the defaults continue to work even after remapping.
Author
Owner

@DHowett-MSFT commented on GitHub (Oct 24, 2019):

I dug up a keyboard with a numpad, and checked out what we're supposed to do (based on some other terminal emulators.)

It looks like Shift disengages numlock temporarily, across the board -- even Notepad responds as though you pressed the traditional arrow keys.

Ctrl+Shift+Numpad_4 (Left)

Application No Modifier Ctrl Shift Ctrl+Shift
notepad 4 nothing caret left
same as
caret back one word
same as Ctrl+←
conhost 4 nothing \x1b[D
same as
\x1b[1;5D
same as Ctrl+←
Windows Terminal 4 nothing \x1b[D
same as
\x1b[1;5D
same as Ctrl+←
PuTTY 4 4 \x1b[D
same as
\x1b[1;5D
same as Ctrl+←

Now, as for why Windows Terminal can't bind that combo ... Ctrl+Shift+Numpad4 literally comes into the application as "the user pressed Ctrl+←". ☹️

        + Key Down
        |                    + VK_LEFT  <<< Here
        v                    v
MESSAGE 00000100 004b0001 0025

        + Key Down
        |                    + VK_LSHIFT
        v                    v
MESSAGE 00000100 002a0001 0010

        + Key Up
        |                    + VK_SHIFT
        v                    v
MESSAGE 00000101 c02a0001 0010

        + Key Up
        |                    + VK_NUMPAD4
        v                    v
MESSAGE 00000101 804b0001 0064

Curiously, a real left arrow looks ever so slightly different (on an en-US PC 104 keyboard)

        + Key Down
        |         + A 1 here means "extended key"
        |         |          + VK_LEFT
        v         v          v
MESSAGE 00000100 014b0001 0025
MESSAGE 00000101 c14b0001 0025
@DHowett-MSFT commented on GitHub (Oct 24, 2019): I dug up a keyboard with a numpad, and checked out what we're supposed to do (based on some other terminal emulators.) It looks like <kbd>Shift</kbd> disengages numlock temporarily, across the board -- even Notepad responds as though you pressed the traditional arrow keys. ### Ctrl+Shift+Numpad_4 (Left) |Application|No Modifier|<kbd>Ctrl</kbd>|<kbd>Shift</kbd>|<kbd>Ctrl+Shift</kbd>| |-|-|-|-|-| |**notepad**|`4`|_nothing_|_caret left_<br>_same as <kbd>←</kbd>_|_caret back one word_<br>_same as <kbd>Ctrl+←</kbd>_| |**conhost**|`4`|_nothing_|`\x1b[D`<br>_same as <kbd>←</kbd>_|`\x1b[1;5D`<br>_same as <kbd>Ctrl+←</kbd>_| |**Windows Terminal**|`4`|_nothing_|`\x1b[D`<br>_same as <kbd>←</kbd>_|`\x1b[1;5D`<br>_same as <kbd>Ctrl+←</kbd>_| |**PuTTY**|`4`|`4`|`\x1b[D`<br>_same as <kbd>←</kbd>_|`\x1b[1;5D`<br>_same as <kbd>Ctrl+←</kbd>_| Now, as for why Windows Terminal can't _bind_ that combo ... <kbd>Ctrl+Shift+Numpad4</kbd> literally comes into the application as "the user pressed <kbd>Ctrl+←</kbd>". ☹️ ``` + Key Down | + VK_LEFT <<< Here v v MESSAGE 00000100 004b0001 0025 + Key Down | + VK_LSHIFT v v MESSAGE 00000100 002a0001 0010 + Key Up | + VK_SHIFT v v MESSAGE 00000101 c02a0001 0010 + Key Up | + VK_NUMPAD4 v v MESSAGE 00000101 804b0001 0064 ``` Curiously, a real left arrow looks ever so slightly different (**on an en-US PC 104 keyboard**) ``` + Key Down | + A 1 here means "extended key" | | + VK_LEFT v v v MESSAGE 00000100 014b0001 0025 MESSAGE 00000101 c14b0001 0025 ```
Author
Owner

@jimjam-slam commented on GitHub (Oct 24, 2019):

Oh, wow! Yeah, just found a very old devblog post about it. That post notes that the same happens for CapsLock—although I daresay most people would expect a lowercase letter if you held shift and typed with the CapsLock engaged. Perhaps it was thought that analogous behaviour was appropriate for NumLock?

@jimjam-slam commented on GitHub (Oct 24, 2019): Oh, wow! Yeah, just found a [very old devblog post about it](https://devblogs.microsoft.com/oldnewthing/20040906-00/?p=37953). That post notes that the same happens for CapsLock—although I daresay most people would expect a lowercase letter if you held shift and typed with the CapsLock engaged. Perhaps it was thought that analogous behaviour was appropriate for NumLock?
Author
Owner

@DHowett-MSFT commented on GitHub (Dec 2, 2019):

Unfortunately, on digging further (and reading Raymond Chen's blog here), it looks like this just isn't going to be something we can support. This is cooked into the lowest layers of either the input stack or into keyboards themselves. 😦

@DHowett-MSFT commented on GitHub (Dec 2, 2019): Unfortunately, on digging further (and reading Raymond Chen's blog here), it looks like this just isn't going to be something we can support. This is cooked into the lowest layers of either the input stack or into keyboards themselves. 😦
Author
Owner

@jimjam-slam commented on GitHub (Dec 3, 2019):

That's okay! It's possible that a settings UI (if that's in the works further down the line one day) could provide hints on key mappings that use Ctrl+Shift+Numpad, but perhaps that's a separate discussion.

@jimjam-slam commented on GitHub (Dec 3, 2019): That's okay! It's possible that a settings UI (if that's in the works further down the line one day) could provide hints on key mappings that use Ctrl+Shift+Numpad, but perhaps that's a separate discussion.
Author
Owner

@davidwin commented on GitHub (Dec 6, 2019):

As for the settings UI, the regex that I suggested in #2967 could be amended to not validate any combination with shift and numpad keys:

^(?<modifier>(ctrl|alt|shift)(?:\+(ctrl|alt|shift)(?<!\2))?(?:\+(ctrl|alt|shift)(?<!\2|\3))?\+)?(?<key>[^\s+]|backspace|tab|enter|esc|space|pgup|pgdn|end|home|left|up|right|down|insert|delete|(?<!shift.+)numpad_(?:[0-9]|period)|numpad_(?:multiply|plus|minus|divide)|f[1-9]|f1[0-9]|f2[0-4]|plus)$

Well, if you consider a JSON schema a "UI", of course.
(Try it out at Regex101)

Edit: Realized that not all numpad combos are affected by this limitation.

@davidwin commented on GitHub (Dec 6, 2019): As for the settings UI, the regex that I suggested in #2967 could be amended to not validate any combination with shift and numpad keys: ```regex ^(?<modifier>(ctrl|alt|shift)(?:\+(ctrl|alt|shift)(?<!\2))?(?:\+(ctrl|alt|shift)(?<!\2|\3))?\+)?(?<key>[^\s+]|backspace|tab|enter|esc|space|pgup|pgdn|end|home|left|up|right|down|insert|delete|(?<!shift.+)numpad_(?:[0-9]|period)|numpad_(?:multiply|plus|minus|divide)|f[1-9]|f1[0-9]|f2[0-4]|plus)$ ``` Well, if you consider a JSON schema a "UI", of course. (Try it out at [Regex101](https://regex101.com/r/6FEcX6/4)) Edit: Realized that not all numpad combos are affected by this limitation.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#4187