Releasing both pressed Shift keys (left+right) reports only one #22571

Open
opened 2026-01-31 08:17:17 +00:00 by claunia · 3 comments
Owner

Originally created by @o-sdn-o on GitHub (Nov 20, 2024).

Windows Terminal version

current main

Windows build number

10.0.19045.5011

Other Software

No response

Steps to reproduce

  1. Activate "debug tap" pane.
    • Add the global setting (near the top of your JSON file):
      "debugFeatures": true
      
    • Open a new tab while holding down both left and right Alt .
  2. Press and release both Shift keys simultaneously.

Expected Behavior

There are four reports in the "debug tap" pane:

  • The first Shift key was pressed.
  • The second Shift key was pressed.
  • Some Shift key was released.
  • The remaining Shift key was released.

Actual Behavior

Image

There are only three reports in the "debug tap" pane:

  • The first Shift key was pressed.
  • The second Shift key was pressed.
  • Some Shift key was released.
Originally created by @o-sdn-o on GitHub (Nov 20, 2024). ### Windows Terminal version current main ### Windows build number 10.0.19045.5011 ### Other Software _No response_ ### Steps to reproduce 1. Activate "debug tap" pane. - Add the global setting (near the top of your JSON file): ``` "debugFeatures": true ``` - Open a new tab while holding down both left and right Alt . 2. Press and release both Shift keys simultaneously. ### Expected Behavior There are four reports in the "debug tap" pane: - The first Shift key was pressed. - The second Shift key was pressed. - Some Shift key was released. - The remaining Shift key was released. ### Actual Behavior ![Image](https://github.com/user-attachments/assets/e4e03c3d-6d12-4b8e-aa9c-625ffda013c2) There are only three reports in the "debug tap" pane: - The first Shift key was pressed. - The second Shift key was pressed. - Some Shift key was released.
claunia added the Help WantedIssue-BugPriority-3Area-InputProduct-Terminal labels 2026-01-31 08:17:18 +00:00
Author
Owner

@o-sdn-o commented on GitHub (Nov 20, 2024):

Since the operating system (at least 10.0.19045.5011) does not generate a right Shift key release WM_KEYUP event after detecting a second Shift key pressed, the possible solution is to use a timer to track the right Shift key down state in the thread's keyboard buffer. This works reliably with a 33ms tick timer.

@o-sdn-o commented on GitHub (Nov 20, 2024): Since the operating system (at least 10.0.19045.5011) does not generate a right Shift key release `WM_KEYUP` event after detecting a second Shift key pressed, the possible solution is to use a timer to track the right Shift key down state in the thread's keyboard buffer. This works reliably with a 33ms tick timer.
Author
Owner

@carlos-zamora commented on GitHub (Nov 20, 2024):

Thanks for filing! Does this repro in conhost /?

@carlos-zamora commented on GitHub (Nov 20, 2024): Thanks for filing! Does this repro in conhost /?
Author
Owner

@o-sdn-o commented on GitHub (Nov 21, 2024):

Does this repro in conhost /?

Yes, this issue is also reproduced in conhost.

#include <iostream>
#include <windows.h>

int main()
{
    DWORD count;
    INPUT_RECORD r;
    HANDLE input = ::GetStdHandle(STD_INPUT_HANDLE);
    while (true)
    {
        ::ReadConsoleInputW(input, &r, 1, &count);
        if (r.EventType == KEY_EVENT)
        {
            std::cout << "type: KEY_EVENT" << std::hex
                << ", down: " << r.Event.KeyEvent.bKeyDown
                << ", ctrl: " << r.Event.KeyEvent.dwControlKeyState
                << ", count: " << r.Event.KeyEvent.wRepeatCount
                << ", vcod: " << r.Event.KeyEvent.wVirtualKeyCode
                << ", scod: " << r.Event.KeyEvent.wVirtualScanCode
                << ", wchr: " << (int)r.Event.KeyEvent.uChar.UnicodeChar << '\n';
        }
    }
}

Image

@o-sdn-o commented on GitHub (Nov 21, 2024): >Does this repro in conhost /? Yes, this issue is also reproduced in conhost. ```c++ #include <iostream> #include <windows.h> int main() { DWORD count; INPUT_RECORD r; HANDLE input = ::GetStdHandle(STD_INPUT_HANDLE); while (true) { ::ReadConsoleInputW(input, &r, 1, &count); if (r.EventType == KEY_EVENT) { std::cout << "type: KEY_EVENT" << std::hex << ", down: " << r.Event.KeyEvent.bKeyDown << ", ctrl: " << r.Event.KeyEvent.dwControlKeyState << ", count: " << r.Event.KeyEvent.wRepeatCount << ", vcod: " << r.Event.KeyEvent.wVirtualKeyCode << ", scod: " << r.Event.KeyEvent.wVirtualScanCode << ", wchr: " << (int)r.Event.KeyEvent.uChar.UnicodeChar << '\n'; } } } ``` ![Image](https://github.com/user-attachments/assets/218e2d31-73d4-447e-b271-23ea02594459)
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#22571