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

Enable shortcut while CommandPalette is open #8044

Merged
6 commits merged into from Dec 14, 2020
Merged

Enable shortcut while CommandPalette is open #8044

6 commits merged into from Dec 14, 2020

Conversation

ghost
Copy link

@ghost ghost commented Oct 26, 2020

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

References

PR Checklist

  • Closes commandPalette keybinding should close the palette when it's open #6679
  • CLA signed. If not, go over here and sign the CLA
  • Tests added/passed
  • Documentation updated. If checked, please file a pull request on our docs repo 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

Detailed Description of the Pull Request / Additional comments

Validation Steps Performed

@ghost ghost added Area-User Interface Issues pertaining to the user interface of the Console or Terminal Impact-Compliance It gotta be this way. Product-Terminal The new Windows Terminal. labels Oct 26, 2020
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.

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.

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 27, 2020
@zadjii-msft zadjii-msft assigned ghost Oct 27, 2020
@ghost
Copy link
Author

ghost commented Oct 29, 2020

I will try 🙃

@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Oct 29, 2020
@ghost
Copy link
Author

ghost commented Nov 2, 2020

I'm trying to get default.json using CascadiaSettings::LoadDefaults() and do KeyMap(), but it dosen't work.

@zadjii-msft
Copy link
Member

I'm trying to get default.json using CascadiaSettings::LoadDefaults() and do KeyMap(), but it dosen't work.

I wouldn't bother with all that - the TerminalPage already has a perfectly good CascadiaSettings object (_settings) that's got the entirely loaded settings. Don't bother re-loading the settings, just use that one.

src/cascadia/TerminalApp/CommandPalette.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/CommandPalette.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/CommandPalette.cpp Outdated Show resolved Hide resolved
@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Nov 4, 2020
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.

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

@ghost ghost added Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something and removed Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something labels Nov 17, 2020
@ghost
Copy link
Author

ghost commented Nov 18, 2020

@zadjii-msft I fixed second issue, but I couldn't understand the first problem. When I press ctrl+shift+p the cursor blinks that's it(is this because of re-opening?), I couldn't even dismiss the command palette. Dose this also occur for you as well?

@zadjii-msft
Copy link
Member

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 toggleCommandPalette action, which is causing the palette to re-appear.

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.

@ghost
Copy link
Author

ghost commented Nov 19, 2020

I forgot that I was closing CommandPalette at first. Now I changed to close it when action is not toggleCommandPalette.

@zadjii-msft zadjii-msft self-assigned this Nov 20, 2020
@zadjii-msft zadjii-msft unassigned zadjii-msft and ghost Nov 30, 2020
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.

Sorry for misleading you on the ctrl+tab thing - let's remove that special case handling, but otherwise this feels good. Thanks!

src/cascadia/TerminalApp/CommandPalette.cpp Outdated Show resolved Hide resolved
@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Nov 30, 2020
@zadjii-msft zadjii-msft assigned ghost Nov 30, 2020
Co-authored-by: Mike Griese <migrie@microsoft.com>
@ghost ghost removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Dec 1, 2020
Co-authored-by: Mike Griese <migrie@microsoft.com>
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.

Thanks!

@ghost ghost added Area-CmdPal Command Palette issues and features Issue-Task It's a feature request, but it doesn't really need a major design. Priority-2 A description (P2) labels Dec 3, 2020
@zadjii-msft zadjii-msft unassigned ghost Dec 3, 2020
@zadjii-msft zadjii-msft added Needs-Second It's a PR that needs another sign-off and removed Impact-Compliance It gotta be this way. labels Dec 3, 2020
src/cascadia/TerminalApp/CommandPalette.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/CommandPalette.cpp Show resolved Hide resolved
src/cascadia/TerminalApp/CommandPalette.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/CommandPalette.cpp Outdated Show resolved Hide resolved
src/cascadia/TerminalApp/CommandPalette.cpp Show resolved Hide resolved
@microsoft microsoft deleted a comment Dec 3, 2020
@ghost
Copy link
Author

ghost commented Dec 14, 2020

@carlos-zamora I made a change. Please review!

Copy link
Member

@carlos-zamora carlos-zamora left a comment

Choose a reason for hiding this comment

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

Thanks!

@carlos-zamora carlos-zamora added the AutoMerge Marked for automatic merge by the bot when requirements are met label Dec 14, 2020
@ghost
Copy link

ghost commented Dec 14, 2020

Hello @carlos-zamora!

Because this pull request has the AutoMerge label, I will be glad to assist with helping to merge this pull request once all check-in policies pass.

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 (@msftbot) and give me an instruction to get started! Learn more here.

@ghost ghost merged commit 1965fb5 into microsoft:main Dec 14, 2020
@DHowett
Copy link
Member

DHowett commented Dec 14, 2020

@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.

@ghost ghost deleted the dev/7914-perform_while_open branch December 14, 2020 18:31
DHowett added a commit that referenced this pull request Dec 14, 2020
@DHowett
Copy link
Member

DHowett commented Dec 14, 2020

Hi @Hegunumo! Sorry about this. I had to revert this pull request because it caused a build break in main.

Reversion: 61ccf44
Reopening #6679

If you make a fix on top of commit 1965fb5, we can merge the two back together.

@ghost ghost restored the dev/7914-perform_while_open branch December 14, 2020 19:48
mpela81 pushed a commit to mpela81/terminal that referenced this pull request Jan 28, 2021
<!-- 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
mpela81 pushed a commit to mpela81/terminal that referenced this pull request Jan 28, 2021
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-CmdPal Command Palette issues and features Area-User Interface Issues pertaining to the user interface of the Console or Terminal AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Task It's a feature request, but it doesn't really need a major design. Needs-Second It's a PR that needs another sign-off Priority-2 A description (P2) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

commandPalette keybinding should close the palette when it's open
4 participants