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

Fix crash and empty action in SUI Actions Page #11427

Merged
1 commit merged into from
Oct 6, 2021

Conversation

carlos-zamora
Copy link
Member

Summary of the Pull Request

Fixes two issues related to SUI's Actions page:

  1. Crash when adding an action and setting key chord to one that is already taken
    • Cause: the new key binding that was introduced with the "Add new" button appears in _KeyBindingList that we're iterating over. This has no CurrentKeys(), resulting in a null pointer exception.
    • Fix: null-check it
  2. There's an action that appears as being nameless in the dropdown
    • Cause: The culprit seems to be MultipleActions. We would register it, but it wouldn't have a name, so it would appear as a nameless option.
    • Fix: if it has no name, don't register it. This is also future-proof in that any new nameless actions won't be automatically added.

Closes #10981
Part of #11353

@ghost ghost added Area-Settings UI Anything specific to the SUI Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal. labels Oct 6, 2021
@@ -369,7 +369,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
{
const auto kbdVM{ get_self<KeyBindingViewModel>(_KeyBindingList.GetAt(i)) };
const auto& otherKeys{ kbdVM->CurrentKeys() };
Copy link
Member

Choose a reason for hiding this comment

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

The & isn't necessarily needed here.

if (actionAndArgs->Action() != ShortcutAction::Invalid)
/*We have a valid action.*/
/*Check if the action was already added.*/
if (visited.find(Hash(*actionAndArgs)) == visited.end())
Copy link
Member

Choose a reason for hiding this comment

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

You can use the count() method instead of find() if you'd like.
The C-style comments could also be replaced with modern ones.

Copy link
Member

Choose a reason for hiding this comment

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

I might have blocked over the two of these nits combined -- the comments don't follow our style at all (even spacing-wise), for example..?

Copy link
Member Author

Choose a reason for hiding this comment

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

I didn't add the comments though...

@zadjii-msft zadjii-msft added the AutoMerge Marked for automatic merge by the bot when requirements are met label Oct 6, 2021
@ghost
Copy link

ghost commented Oct 6, 2021

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 14d068f into main Oct 6, 2021
@ghost ghost deleted the dev/cazamor/sui/bugfix-actions branch October 6, 2021 11:33
@ghost
Copy link

ghost commented Oct 20, 2021

🎉Windows Terminal Preview v1.12.2922.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
Area-Settings UI Anything specific to the SUI AutoMerge Marked for automatic merge by the bot when requirements are met Issue-Bug It either shouldn't be doing this or needs an investigation. Product-Terminal The new Windows Terminal.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Actions with no name appear as nameless in SUI
4 participants