microsoft/Terminal

ENHANCED_KEY flag missing when releasing RightAlt

Open

#18.120 aperta il 28 ott 2024

Vedi su GitHub
 (1 commento) (0 reazioni) (0 assegnatari)C++ (3212 fork)batch import
Area-InputHelp WantedIssue-BugProduct-Terminal

Metriche repository

Star
 (35.764 star)
Metriche merge PR
 (Merge medio 27g 19h) (24 PR mergiate in 30 g)

Descrizione

Windows Terminal version

current main

Windows build number

10.0.19045.4894

Other Software

No response

Steps to reproduce

  1. Run the following c++ code:
#include <iostream>
#include <windows.h>
int main()
{
    INPUT_RECORD rec;
    DWORD count;
    while (true)
    {
        ::ReadConsoleInputW(::GetStdHandle(STD_INPUT_HANDLE), &rec, 1, &count);
        if (rec.EventType == KEY_EVENT)
        {
            std::cout << "type: KEY_EVENT" << std::hex
                      << ", down: " << rec.Event.KeyEvent.bKeyDown
                      << ", ENHANCED_KEY: " << !!(rec.Event.KeyEvent.dwControlKeyState & ENHANCED_KEY)
                      << ", ctrl: 0x" << rec.Event.KeyEvent.dwControlKeyState
                      << ", vcod: 0x" << rec.Event.KeyEvent.wVirtualKeyCode
                      << ", scod: 0x" << rec.Event.KeyEvent.wVirtualScanCode
                      << ", wchr: 0x" << rec.Event.KeyEvent.uChar.UnicodeChar << '\n';
        }
    }
}
  1. Press LeftCtrl key, press RightCtrl key, check ENHANCED_KEY flag.
  2. Press LeftAlt key, press RightAlt key, check ENHANCED_KEY flag.

Expected Behavior

The ENHANCED_KEY flag is present when RightAlt is pressed and released.

The current conhost.exe is not affected by this issue.

Actual Behavior

The ENHANCED_KEY flag is absent when RightAlt is released, but is present when RightAlt is pressed.

Guida contributor