[PR #1718] Add a ControlKeyStates wrapper class #24653

Open
opened 2026-01-31 09:04:35 +00:00 by claunia · 0 comments
Owner

Original Pull Request: https://github.com/microsoft/terminal/pull/1718

State: closed
Merged: Yes


Summary of the Pull Request

As a continuation to #1436 this PR adds a Microsoft::Terminal::Core::ControlKeyStates class which will act as a safe wrapper for the ControlKeyState enum, found in the NT console subsystem (<um/wincon.h>) and used throughout the older parts of this project.

PR Checklist

  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Requires documentation to be updated
  • I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #1436

Detailed Description of the Pull Request / Additional comments

Feel free to reject, modify, adopt or otherwise use this code in any way or form.
If you have comments I'll try my best of integrating them.
The ControlKeyStates class I wrote is as good as I was able to think of one for now which is compatible to the rest of the code base.
I think it should replace the KeyModifiers enum, but I'm a total C# noob and was afraid of doing so (my total C# experience is about 10h or so and I haven't even touched IDLs yet lol).

Validation Steps Performed

As with #1436 I tested all possible Alt/Ctrl/Shift/AltGr combinations on my german keyboard using PowerShell and wsl.
Only AltGr+E (= €) on PowerShell failed to work, but I strongly assume that this is due to the ReadLine module or similar, as it works with wsl.

**Original Pull Request:** https://github.com/microsoft/terminal/pull/1718 **State:** closed **Merged:** Yes --- ## Summary of the Pull Request As a continuation to #1436 this PR adds a `Microsoft::Terminal::Core::ControlKeyStates` class which will act as a safe wrapper for the ControlKeyState enum, found in the NT console subsystem (`<um/wincon.h>`) and used throughout the older parts of this project. <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [x] Requires documentation to be updated * [ ] I've discussed this with core contributors already. If not checked, I'm ready to accept this work might be rejected in favor of a different grand plan. Issue number where discussion took place: #1436 ## Detailed Description of the Pull Request / Additional comments Feel free to reject, modify, adopt or otherwise use this code in any way or form. If you have comments I'll try my best of integrating them. The `ControlKeyStates` class I wrote is as good as I was able to think of one for now which is compatible to the rest of the code base. I think it should replace the `KeyModifiers` enum, but I'm a total C# noob and was afraid of doing so (my total C# experience is about 10h or so and I haven't even touched IDLs yet lol). ## Validation Steps Performed As with #1436 I tested all possible Alt/Ctrl/Shift/AltGr combinations on my german keyboard using PowerShell and wsl. Only AltGr+E (= €) on PowerShell failed to work, but I strongly assume that this is due to the ReadLine module or similar, as it works with wsl.
claunia added the pull-request label 2026-01-31 09:04:35 +00:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#24653