Skip to content

Commit

Permalink
better if
Browse files Browse the repository at this point in the history
  • Loading branch information
PankajBhojwani committed May 1, 2024
1 parent c2c75c8 commit 3e601f5
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/cascadia/TerminalSettingsModel/ActionMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,11 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
// there might be a collision here, where there could be 2 different commands with the same name
// in this case, prioritize the user's action
if (nameMap.find(name) != nameMap.end() && cmd.Origin() != OriginTag::User)
{
// a command with this name already exists in the map and this command is not a user-defined one, ignore it
continue;
}
else
if (nameMap.find(name) == nameMap.end() || cmd.Origin() == OriginTag::User)
{
// either a command with this name does not exist, or this is a user-defined command with a name
// in either case, update the name map with the command (if this is a user-defined command with
// the same name as an existing command, the existing one will get overwritten)
nameMap.insert_or_assign(name, cmd);
}
}
Expand Down

0 comments on commit 3e601f5

Please sign in to comment.