-
Notifications
You must be signed in to change notification settings - Fork 9.1k
Closed
Labels
Area-InputRelated to input processing (key presses, mouse, etc.)Related to input processing (key presses, mouse, etc.)In-PRThis issue has a related PRThis issue has a related PRIssue-BugIt either shouldn't be doing this or needs an investigation.It either shouldn't be doing this or needs an investigation.Issue-TaskIt's a feature request, but it doesn't really need a major design.It's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.The new Windows Terminal.
Milestone
Description
Environment
Windows build number: 10.0.19041.572
Windows Terminal version (if applicable): master
In the classic windows console, you can track alphanumeric key combinations (for example, tracking the keys w, a, s, d simultaneously). This tracking cannot be done in Windows Terminal.
Steps to reproduce
Run the following code
Press a couple of alphanumeric keys at the same time, e.g. q+w+e
#include <iostream>
#include <unordered_set>
#include <Windows.h>
int main()
{
DWORD Count;
INPUT_RECORD Reply;
std::unordered_set<WORD> State;
auto Input = GetStdHandle(STD_INPUT_HANDLE);
while (WAIT_OBJECT_0 == WaitForSingleObject(Input, INFINITE))
{
ReadConsoleInput(Input, &Reply, 1, &Count);
switch (Reply.EventType)
{
case KEY_EVENT:
{
//std::cout
// << " Down: " << Reply.Event.KeyEvent.bKeyDown
// << " Repeat: " << Reply.Event.KeyEvent.wRepeatCount
// << " KeyCode: " << Reply.Event.KeyEvent.wVirtualKeyCode
// << " ScanCode: " << Reply.Event.KeyEvent.wVirtualScanCode
// << " Char: " << Reply.Event.KeyEvent.uChar.UnicodeChar
// << " KeyState: " << Reply.Event.KeyEvent.dwControlKeyState
// << std::endl << std::flush;
auto ScanCode = Reply.Event.KeyEvent.wVirtualScanCode;
auto KeyDown = Reply.Event.KeyEvent.bKeyDown;
auto Changed = KeyDown ? State.emplace(ScanCode).second
: State.erase(ScanCode);
if (Changed)
{
std::cout << "chord:";
for (auto Key : State) std::cout << " " << Key;
std::cout << std::endl << std::flush;
}
break;
}
default:
break;
}
}
}
Expected behavior
Key combinations are tracked (classic console behavior)
D:\sources\temp\ConsoleApplication1\Debug>ConsoleApplication1.exe
chord: 16
chord: 16 17
chord: 16 17 18
chord: 16 17
chord: 16
chord:
chord: 16
chord: 16 17
chord: 16 17 18
chord: 17 18
chord: 18
chord:
Actual behavior
Single keystrokes are tracked only (Windows Terminal behavior)
D:\sources\temp\ConsoleApplication1\Debug>ConsoleApplication1.exe
chord: 16
chord:
chord: 17
chord:
chord: 18
chord:
chord: 18
chord:
chord: 18
chord:
chord: 18
chord:
chord: 18
chord:
...
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
Area-InputRelated to input processing (key presses, mouse, etc.)Related to input processing (key presses, mouse, etc.)In-PRThis issue has a related PRThis issue has a related PRIssue-BugIt either shouldn't be doing this or needs an investigation.It either shouldn't be doing this or needs an investigation.Issue-TaskIt's a feature request, but it doesn't really need a major design.It's a feature request, but it doesn't really need a major design.Needs-Tag-FixDoesn't match tag requirementsDoesn't match tag requirementsProduct-TerminalThe new Windows Terminal.The new Windows Terminal.