-
Notifications
You must be signed in to change notification settings - Fork 8.5k
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
Enable shortcut while CommandPalette is open #8044
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Okay this absolutely won't work - what if the user's re-defined their keybindings? What if they've added actions? As soon as the user's list of actions doesn't exactly match the defaults, this solution won't work.
A better idea would be to pass the key event to the IKeyBindings
from the settings, and let that object try and figure out what the action for the given key chord would be.
I will try 🙃 |
I'm trying to get default.json using |
I wouldn't bother with all that - the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This works pretty well actually! There's only two cases that seem weird, and I'm not really sure if they're worth blocking this whole PR over:
- If you press ctrl+shift+p to dismiss the command palette, then immediately the palette will re-open itself on the key up. Maybe we need to special-case that action, to only dispatch it on a key-up?
- ctrl+tab to move to the next tab doesn't actually dispatch that action. It seems like the text box eats that keystroke first. That's probably okay though? At least intuitively, I saw that happen and thought "oh, yea that makes sense".
So I'm blocking over the ToggleCommandPalette
action thing, but I am open to being convinced otherwise by other reviewers
@zadjii-msft I fixed second issue, but I couldn't understand the first problem. When I press |
Yea, so that's basically what's happening to me to. I'm guessing that what's happening is that all in the course of 1-2 frames, the palette is being dismissed, the focus is moving back to the control (causing the cursor to blink), and then on the key up of P, we're sending another I don't have the branch checked out locally right now to confirm, but I bet if you press and hold the P key, you won't see the palette re-appear until the key is released. |
I forgot that I was closing CommandPalette at first. Now I changed to close it when action is not |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for misleading you on the ctrl+tab thing - let's remove that special case handling, but otherwise this feels good. Thanks!
Co-authored-by: Mike Griese <[email protected]>
Co-authored-by: Mike Griese <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
@carlos-zamora I made a change. Please review! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!
Hello @carlos-zamora! Because this pull request has the p.s. you can customize the way I help with merging this pull request, such as holding this pull request until a specific person approves. Simply @mention me (
|
@carlos-zamora when you automerge, please try to make sure you edit the PR body to explain what actually happened. It looks like the words in the body of this PR are way, way different from the final implementation! Future readers who only have the git blame will not have the context y’all had when reviewing it. |
<!-- Enter a brief description/summary of your PR here. What does it fix/what does it change/how was it tested (even manually, if necessary)? --> ## Summary of the Pull Request It is maybe not the best way since I had to get all the cases for key handling so I just created for each of them. As a result the code get longer(not optimized). Most difficult thing was Next tab and Previous tab I just could not solve it. ### 9 commands that couldn't enabled > < 1. Increase font size -> could not find VirtualKey for "-" 2. Decrease font size -> could not find VirtualKey for "+" 3. Split pane, split:horizontal -> could not find VirtualKey for "-" 4. Split pane, split:vertical -> could not find VirtualKey for "+" 5. Open default settings -> could not find VirtualKey for "," 6. Open settings file -> could not find VirtualKey for "," 7. Open new tab dropdown -> could not resolve keybindings 8. Next tab -> could not resolve keybindings 9. Previous tab -> could not resolve keybindings <!-- Other than the issue solved, is this relevant to any other issues/existing PRs? --> ## References <!-- Please review the items on the PR checklist before submitting--> ## PR Checklist * [x] Closes microsoft#6679 * [x] CLA signed. If not, go over [here](https://cla.opensource.microsoft.com/microsoft/Terminal) and sign the CLA * [ ] Tests added/passed * [ ] Documentation updated. If checked, please file a pull request on [our docs repo](https://github.com/MicrosoftDocs/terminal) and link it here: #xxx * [ ] Schema 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: #xxx <!-- Provide a more detailed description of the PR, other things fixed or any additional comments/features here --> ## Detailed Description of the Pull Request / Additional comments <!-- Describe how you validated the behavior. Add automated tests wherever possible, but list manual validation steps taken as well --> ## Validation Steps Performed
This reverts commit 1965fb5.
Summary of the Pull Request
It is maybe not the best way since I had to get all the cases for key handling so I just created for each of them. As a result the code get longer(not optimized). Most difficult thing was Next tab and Previous tab I just could not solve it.
9 commands that couldn't enabled > <
References
PR Checklist
commandPalette
keybinding should close the palette when it's open #6679Detailed Description of the Pull Request / Additional comments
Validation Steps Performed