@@ -95,22 +95,17 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
95
95
// - had an ID generated for them
96
96
// - do not have a name/icon path
97
97
// - have a hash that matches a command in the inbox actions
98
- std::unordered_set<winrt::hstring> IdsToRemove;
99
- for (const auto [userID, userCmd] : _ActionMap)
100
- {
101
- const auto userCmdImpl{ get_self<Command>(userCmd) };
102
-
103
- // Note we don't need to explicitly check for the origin tag here since we only generate IDs for user actions,
104
- // so if we ID was generated it means this is a user action
105
- if (userCmdImpl->IdWasGenerated () && !userCmdImpl->HasName () && userCmd.IconPath ().empty ())
98
+ std::erase_if (_ActionMap, [&](const auto & pair) {
99
+ const auto userCmdImpl{ get_self<Command>(pair.second ) };
100
+ if (userCmdImpl->IdWasGenerated () && !userCmdImpl->HasName () && userCmdImpl->IconPath ().empty ())
106
101
{
107
- const auto userActionHash = Hash (userCmd. ActionAndArgs ());
102
+ const auto userActionHash = Hash (userCmdImpl-> ActionAndArgs ());
108
103
if (const auto inboxCmd = inboxActions.find (userActionHash); inboxCmd != inboxActions.end ())
109
104
{
110
105
for (const auto & [key, cmdID] : _KeyMap)
111
106
{
112
107
// for any of our keys that point to the user action, point them to the inbox action instead
113
- if (cmdID == userID )
108
+ if (cmdID == pair. first )
114
109
{
115
110
_KeyMap.insert_or_assign (key, inboxCmd->second .ID ());
116
111
@@ -119,14 +114,12 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
119
114
}
120
115
}
121
116
122
- // add this ID to our set of IDs to remove
123
- IdsToRemove. insert (userID) ;
117
+ // remove this pair
118
+ return true ;
124
119
}
125
120
}
126
- }
127
-
128
- // now, remove the commands with the IDs we found
129
- std::erase_if (_ActionMap, [&IdsToRemove](const auto & pair) { return IdsToRemove.contains (pair.first ); });
121
+ return false ;
122
+ });
130
123
}
131
124
132
125
bool ActionMap::FixUpsAppliedDuringLoad () const
0 commit comments