Skip to content
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

Send a Ctrl-C KeyUp event #5431

Merged
3 commits merged into from
Apr 22, 2020
Merged

Conversation

leonMSFT
Copy link
Contributor

Summary of the Pull Request

Users were not able to intercept Ctrl-C input using $Host.UI.RawUI.ReadKey("IncludeKeyUp"), because we weren't sending a Ctrl-C KeyUp event. This PR simply adds a KeyUp event alongside the existing KeyDown.

PR Checklist

Validation Steps Performed

The repro script in #1894 now works, both options for ReadKey: IncludeKeyUp and IncludeKeyDown work fine.

Copy link
Member

@zadjii-msft zadjii-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what comes down must come back up

i love it

@DHowett-MSFT
Copy link
Contributor

@msftbot make sure @miniksa signs off

@ghost ghost added the AutoMerge Marked for automatic merge by the bot when requirements are met label Apr 21, 2020
@ghost
Copy link

ghost commented Apr 21, 2020

Hello @DHowett-MSFT!

Because you've given me some instructions on how to help merge this pull request, I'll be modifying my merge approach. Here's how I understand your requirements for merging this pull request:

  • I'll only merge this pull request if it's approved by @miniksa

If this doesn't seem right to you, you can tell me to cancel these instructions and use the auto-merge policy that has been configured for this repository. Try telling me "forget everything I just told you".

@DHowett-MSFT
Copy link
Contributor

Just want to make sure: Control events can be sketchy business here in Terminal land

Copy link
Contributor

@DHowett-MSFT DHowett-MSFT left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems sane to me, I'm just worried about the repercussions on ^C generation 😄

@miniksa
Copy link
Member

miniksa commented Apr 22, 2020

Just want to make sure: Control events can be sketchy business here in Terminal land

This seems sane to me, I'm just worried about the repercussions on ^C generation 😄

The Ctrl+C chord in regular conhost event dispatch land always comes with the pair of down and up. It's actually really weird to only be doing half of it. As far as I can tell, this is what we should have been doing the whole time (until proven otherwise by some mysterious future bug that may or may not exist.)

@ghost ghost merged commit 632e8ff into master Apr 22, 2020
@ghost ghost deleted the dev/lelian/idontwantmybranchnametoberelevanttoday branch April 22, 2020 17:28
DHowett-MSFT pushed a commit that referenced this pull request Apr 27, 2020
## Summary of the Pull Request
Users were not able to intercept Ctrl-C input using `$Host.UI.RawUI.ReadKey("IncludeKeyUp")`, because we weren't sending a Ctrl-C KeyUp event. This PR simply adds a KeyUp event alongside the existing KeyDown.

<!-- Please review the items on the PR checklist before submitting-->
## PR Checklist
* [x] Closes #1894
* [x] CLA signed.
* [x] Tests added/passed

<!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well -->
## Validation Steps Performed
The repro script in #1894 now works, both options for `ReadKey`: `IncludeKeyUp` and `IncludeKeyDown` work fine.
@ghost
Copy link

ghost commented Apr 28, 2020

🎉Windows Terminal Preview v0.11.1191.0 has been released which incorporates this pull request.:tada:

Handy links:

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
AutoMerge Marked for automatic merge by the bot when requirements are met
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ctrl+C can't be intercepted by PowerShell for shutdown
5 participants