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

Make cmd palette 'go back' button return to previously selected action #13504

Merged
2 commits merged into from
Jul 19, 2022

Conversation

JerBast
Copy link
Contributor

@JerBast JerBast commented Jul 14, 2022

The behaviour of the 'go back' button in the command palette was changed to return to the previously selected element rather than the root.

Instead of returning to the root, the go back button now returns to the previously selected item in the filtered action list. The previously selected item is selected by default and the view is scoped to the item.

Validation Steps Performed

Manually tested by going back and forth between nested actions in the command palette.

Closes #13457

@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-3 A description (P3) Product-Terminal The new Windows Terminal. labels Jul 14, 2022
@JerBast JerBast marked this pull request as ready for review July 14, 2022 13:09
Copy link
Member

@DHowett DHowett left a comment

Choose a reason for hiding this comment

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

I love it, thank you!

It feels pretty economical to search for the last active entry in the list of entries, and to rebuild the nested list like this. It would be good follow-up work to deduplicate the code that generates _currentNestedCommands from a Command, but I'm not going to ask you to do that now... unless you want bonus points[1]

[1] points don't matter, but i like to pretend they do

@JerBast
Copy link
Contributor Author

JerBast commented Jul 16, 2022

Thank you for the review.

I agree that it would be better to deduplicate that fragment. I'll make sure to change it!

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 is great, thanks for whipping this up!

Comment on lines +563 to +564
const auto lastSelectedIndex = static_cast<int32_t>(std::distance(begin(_filteredActions), lastSelectedIt));
_scrollToIndex(lastSelectedIt != end(_filteredActions) ? lastSelectedIndex : 0);
Copy link
Member

Choose a reason for hiding this comment

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

this is clever, I love it

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Jul 19, 2022
@ghost
Copy link

ghost commented Jul 19, 2022

Hello @zadjii-msft!

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 0337869 into microsoft:main Jul 19, 2022
@ghost
Copy link

ghost commented Sep 13, 2022

🎉Windows Terminal Preview v1.16.252 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
Area-CmdPal Command Palette issues and features 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. Priority-3 A description (P3) Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Command palette goes to the top when you go back (<) from a submenu
3 participants