F16 Is not usable in Terminal #19453

Open
opened 2026-01-31 06:43:48 +00:00 by claunia · 7 comments
Owner

Originally created by @richardcox13 on GitHub (Feb 25, 2023).

Windows Terminal version

1.16.10261.0

Windows build number

10.0.19044.2604

Other Software

Happens running cmd or pwsh 7.3.2 within the tab.

Steps to reproduce

Have a keyboard with additional function keys.
Run an app that reports key presses.
In terminal F13, F14, & F15 work. But F16 does not: no input is seen. Also cannot map to a WT action.

The test application works with F16 (including with modifiers) under conhost.exe. Also seen (and mappable) in Visual Studio 2022 (didn't check earlier versions).

Expected Behavior

See keyboard input when F16 is pressed. Can map to actions, and when pressed that action is triggered.

Actual Behavior

F16 does nothing in Windows Terminal and applications running within Windows Terminal.

Originally created by @richardcox13 on GitHub (Feb 25, 2023). ### Windows Terminal version 1.16.10261.0 ### Windows build number 10.0.19044.2604 ### Other Software Happens running cmd or pwsh 7.3.2 within the tab. ### Steps to reproduce Have a keyboard with additional function keys. Run an app that reports key presses. In terminal F13, F14, & F15 work. But F16 does not: no input is seen. Also cannot map to a WT action. The test application works with F16 (including with modifiers) under conhost.exe. Also seen (and mappable) in Visual Studio 2022 (didn't check earlier versions). ### Expected Behavior See keyboard input when F16 is pressed. Can map to actions, and when pressed that action is triggered. ### Actual Behavior F16 does nothing in Windows Terminal and applications running within Windows Terminal.
Author
Owner

@zadjii-msft commented on GitHub (Feb 27, 2023):

Curious. We do have a (de)serializer for f16

    XX(VK_F16, L"f16")                                   \

It's not in any of the terminalInput.cpp maps, but that's only relevant for VT input. If it works for conhost, then you're most likely not even hitting the VT input path.

Can you try repro'ing this with the debug tap to get a trace of all the input and output/? Once the bug starts occurring, send us a screenshot and we might be able to figure out what the Terminal thinks it's getting here.

@zadjii-msft commented on GitHub (Feb 27, 2023): Curious. We do have a (de)serializer for f16 ```c++ XX(VK_F16, L"f16") \ ``` It's not in any of the `terminalInput.cpp` maps, but that's only relevant for VT input. If it works for conhost, then you're most likely not even hitting the VT input path. Can you try repro'ing this with the [debug tap](https://github.com/microsoft/terminal/wiki/Enabling-the-debug-tap) to get a trace of all the input and output/? Once the bug starts occurring, send us a screenshot and we might be able to figure out what the Terminal thinks it's getting here.
Author
Owner

@richardcox13 commented on GitHub (Feb 27, 2023):

Before any interaction:

image

then just switch focus to Windows Terminal and press F16:

image

Hope this is understandable....

@richardcox13 commented on GitHub (Feb 27, 2023): Before any interaction: ![image](https://user-images.githubusercontent.com/4578827/221608104-b0d0bdb3-0d47-49d2-a12f-7f68dbfc5b09.png) then just switch focus to Windows Terminal and press F16: ![image](https://user-images.githubusercontent.com/4578827/221608371-0be39be4-c6c2-40ef-84bf-dd1876d38f09.png) Hope this is understandable....
Author
Owner

@richardcox13 commented on GitHub (Feb 27, 2023):

Should note there certainly was extra additional red text appearing when I hit F16.

@richardcox13 commented on GitHub (Feb 27, 2023): Should note there certainly was extra additional red text appearing when I hit F16.
Author
Owner

@zadjii-msft commented on GitHub (Feb 28, 2023):

␛[123;88;0;1;32;1_

  • ␛[123;88;0;1;32;1_
    • Vk: VK_F12
    • Sc: 88
    • Uc: 0
    • Kd: down
    • Cs: 32

huh

@zadjii-msft commented on GitHub (Feb 28, 2023): ␛[123;88;0;1;32;1_ * `␛[123;88;0;1;32;1_` * `Vk`: VK_F12 * `Sc`: 88 * `Uc`: 0 * `Kd`: `down` * `Cs`: 32 huh
Author
Owner

@zadjii-msft commented on GitHub (Feb 28, 2023):

Yea that's super weird. Looks like the key the Terminal thinks it's getting is F12, not F16. 123 is 0x7b which is VK_F12. VK_F16 would be 0x7f.

I honestly don't know where to investigate that next. If you can build the Terminal from source, I might be able to point you at a function to see what we're getting there.

I might be able to reconfigure my keyboard to have a F16 key. The issue I'd worry about there is that this was more specific to your keyboard/layout, and my keyboard firmware wouldn't repro it 😕 Just out of curiosity, what keyboard & layout are you using?

@zadjii-msft commented on GitHub (Feb 28, 2023): Yea that's super weird. Looks like the key the Terminal thinks it's getting is <kbd>F12</kbd>, _not_ <kbd>F16</kbd>. `123` is `0x7b` which is `VK_F12`. `VK_F16` would be `0x7f`. I honestly don't know where to investigate that next. If you can build the Terminal from source, I might be able to point you at a function to see what we're getting there. I might be able to reconfigure my keyboard to have a F16 key. The issue I'd worry about there is that this was more specific to your keyboard/layout, and my keyboard firmware wouldn't repro it 😕 Just out of curiosity, what keyboard & layout are you using?
Author
Owner

@richardcox13 commented on GitHub (Mar 1, 2023):

The keyboard is a Keychron K6 (UK/ISO) with no customisations.

Outside of Windows Terminal it is seen as F16 ('NET's Console.ReadKey and in Visual Studio's keyboard customisation).

I can have a go at debugging: any hints on getting a development environment running (it has been a long time since I did any Win32/C/C++ development).

@richardcox13 commented on GitHub (Mar 1, 2023): The keyboard is a [Keychron K6 (UK/ISO)](https://www.keychron.com/collections/keychron-uk-iso-keyboards/products/keychron-q6-qmk-custom-mechanical-keyboard-iso-layout-collection?variant=40305598234713) with no customisations. Outside of Windows Terminal it is seen as F16 ('NET's [`Console.ReadKey`](https://learn.microsoft.com/en-gb/dotnet/api/system.console.readkey?view=net-7.0#system-console-readkey(system-boolean)) and in Visual Studio's keyboard customisation). I can have a go at debugging: any hints on getting a development environment running (it has been a long time since I did any Win32/C/C++ development).
Author
Owner

@j4james commented on GitHub (Nov 26, 2023):

I've been doing some work on keyboard handling recently, and for testing purposes I use a little app that can generate keypresses with SendInput calls. This works even with keys that my keyboard doesn't have, like function keys F13 and above.

What I've found, though, is both F16 and F17 don't work on Windows Terminal. F15 and below are fine. F18 to F20 are fine. It's specifically F16 and F17 that fail. And the source of the problem doesn't seem to be in our code - those keys simply don't show up in the TermControl::_KeyHandler. Is it possible this is a UWP/XAML bug?

Note that F16 is not being misinterpreted as F12 in my case, so it's possible this is not the same issue that the OP was seeing. However, it's curious that we're both having problems with F16 specifically.

At the very least I though it worth mentioning that you can potentially reproduce this problem programmatically, even if you don't have a keyboard with an F16 key.

@j4james commented on GitHub (Nov 26, 2023): I've been doing some work on keyboard handling recently, and for testing purposes I use a little app that can generate keypresses with [`SendInput`](https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-sendinput) calls. This works even with keys that my keyboard doesn't have, like function keys <kbd>F13</kbd> and above. What I've found, though, is both <kbd>F16</kbd> and <kbd>F17</kbd> don't work on Windows Terminal. <kbd>F15</kbd> and below are fine. <kbd>F18</kbd> to <kbd>F20</kbd> are fine. It's specifically <kbd>F16</kbd> and <kbd>F17</kbd> that fail. And the source of the problem doesn't seem to be in our code - those keys simply don't show up in the `TermControl::_KeyHandler`. Is it possible this is a UWP/XAML bug? Note that <kbd>F16</kbd> is not being misinterpreted as <kbd>F12</kbd> in my case, so it's possible this is not the same issue that the OP was seeing. However, it's curious that we're both having problems with <kbd>F16</kbd> specifically. At the very least I though it worth mentioning that you can potentially reproduce this problem programmatically, even if you don't have a keyboard with an <kbd>F16</kbd> key.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#19453