-
Notifications
You must be signed in to change notification settings - Fork 305
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot register key handlers for the same key with different modifiers #3555
Comments
The vast majority of these key combinations aren't even able to be received by PSReadLine, just on Windows (and experimenting on macOS/Linux is going to reveal this is even more complicated), try
In short, control characters have a long history, and I would not expect random combinations of |
Yea, there's a lot fiddly stuff going on here. Here's a more minimal case to examine. I'm launching PowerShell directly now to eliminate Windows Terminal from the equation. I've also removed my PowerShell profile Register these 2 handlers, then press
The expectation is that As far as I can tell, |
@akbyrd try this experiment in PowerShell:
Like, directly execute |
ReadKey sees all three chords on my machine.
I didn't explicitly state it in my previous post, but the |
Maybe I am missing something but is it odd that for the last two you posted it does not show the |
It is odd, and it means we (and the users) can't depend on |
Modifiers should be accurate on Windows though. I believe Jason made Shift essentially ignored and instead it looks for the character that would be created. So Ctrl + Shift + , is no different from Ctrl + ,, but Ctrl + < gives the desired result (feel free to correct me if I'm wrong there @lzybkr). |
In summary: key chords are a mess. |
@SeeminglyScience - mostly accurate IIRC. On non-Windows, you couldn't reliably get the shift state required to generate specific keystroke, so I moved towards a world where you wouldn't specify the shift state. I think there were also problems with consistency on Windows even when you could count on the shift state - you might have a profile that works with one keyboard layout but not another. In hindsight I might have gone too far. The world seems to expect that Ctrl+C means Ctrl+c - so maybe the shift state should have been required for alphabetic characters. |
Prerequisites
Exception report
N/A
Screenshot
Environment data
Steps to reproduce
Paste the following text:
,
,
is replaced withecho success
(this handler was never registered)Expected behavior
,
should not have a handler registeredActual behavior
,
has a handler registeredThe text was updated successfully, but these errors were encountered: