Skip to content

Commit

Permalink
don't check for special in standard
Browse files Browse the repository at this point in the history
  • Loading branch information
PankajBhojwani committed Apr 30, 2024
1 parent 2f1d8d2 commit 2b4aeb2
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
4 changes: 3 additions & 1 deletion src/cascadia/TerminalSettingsModel/ActionMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,8 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
}

// Method Description:
// - Retrieves the Command in the current layer
// - Retrieves the Command referred to be the given ID
// - Will recurse through parents if we don't find it in this layer
// Arguments:
// - actionID: the internal ID associated with a Command
// Return Value:
Expand Down Expand Up @@ -126,6 +127,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
#define ON_ALL_ACTIONS(action) RegisterShortcutAction(ShortcutAction::action, availableActions, visitedActionIDs);
ALL_SHORTCUT_ACTIONS
#undef ON_ALL_ACTIONS

_AvailableActionsCache = single_threaded_map(std::move(availableActions));
}
return _AvailableActionsCache.GetView();
Expand Down
31 changes: 10 additions & 21 deletions src/cascadia/TerminalSettingsModel/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -504,32 +504,21 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{
Json::Value cmdList{ Json::ValueType::arrayValue };

if (_nestedCommand || _IterateOn != ExpandCommandType::None)
Json::Value cmdJson{ Json::ValueType::objectValue };
JsonUtils::SetValueForKey(cmdJson, IconKey, _iconPath);
JsonUtils::SetValueForKey(cmdJson, NameKey, _name);
if (!_ID.empty())
{
// handle special commands
// For these, we can trust _originalJson to be correct.
// In fact, we _need_ to use it here because we don't actually deserialize `iterateOn`
// until we expand the command.
cmdList.append(_originalJson);
JsonUtils::SetValueForKey(cmdJson, IDKey, _ID);
}
else
{
Json::Value cmdJson{ Json::ValueType::objectValue };
JsonUtils::SetValueForKey(cmdJson, IconKey, _iconPath);
JsonUtils::SetValueForKey(cmdJson, NameKey, _name);
if (!_ID.empty())
{
JsonUtils::SetValueForKey(cmdJson, IDKey, _ID);
}

if (_ActionAndArgs)
{
cmdJson[JsonKey(ActionKey)] = ActionAndArgs::ToJson(_ActionAndArgs);
}

cmdList.append(cmdJson);
if (_ActionAndArgs)
{
cmdJson[JsonKey(ActionKey)] = ActionAndArgs::ToJson(_ActionAndArgs);
}

cmdList.append(cmdJson);

return cmdList;
}

Expand Down

0 comments on commit 2b4aeb2

Please sign in to comment.