microsoft/Terminal

ENHANCED_KEY flag missing when releasing RightAlt

Open

#18.120 aberto em 28 de out. de 2024

Ver no GitHub
 (1 comment) (0 reactions) (0 assignees)C++ (3.212 forks)batch import
Area-InputHelp WantedIssue-BugProduct-Terminal

Métricas do repositório

Stars
 (35.764 stars)
Métricas de merge de PR
 (Mesclagem média 27d 19h) (24 fundiu PRs em 30d)

Description

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.

Guia do colaborador