From 9b896cea73e2471e9f6e67484d69d07cfb0d6c38 Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Thu, 1 Jul 2021 18:39:00 -0700 Subject: [PATCH] apply PR feedback --- src/cascadia/TerminalSettingsEditor/Actions.cpp | 2 +- src/cascadia/TerminalSettingsEditor/Actions.h | 6 +++--- src/cascadia/TerminalSettingsModel/ActionMap.cpp | 6 +++--- src/cascadia/TerminalSettingsModel/ActionMap.h | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/cascadia/TerminalSettingsEditor/Actions.cpp b/src/cascadia/TerminalSettingsEditor/Actions.cpp index 3e8aaf4f5fd..3476bb4d3ae 100644 --- a/src/cascadia/TerminalSettingsEditor/Actions.cpp +++ b/src/cascadia/TerminalSettingsEditor/Actions.cpp @@ -21,7 +21,7 @@ using namespace winrt::Microsoft::Terminal::Settings::Model; namespace winrt::Microsoft::Terminal::Settings::Editor::implementation { - KeyBindingViewModel::KeyBindingViewModel(const Control::KeyChord& keys, const hstring actionName, const IObservableVector& availableActions) : + KeyBindingViewModel::KeyBindingViewModel(const Control::KeyChord& keys, const hstring& actionName, const IObservableVector& availableActions) : _Keys{ keys }, _KeyChordText{ Model::KeyChordSerialization::ToString(keys) }, _CurrentAction{ actionName }, diff --git a/src/cascadia/TerminalSettingsEditor/Actions.h b/src/cascadia/TerminalSettingsEditor/Actions.h index b1e3dae4acc..a114fdfbb1c 100644 --- a/src/cascadia/TerminalSettingsEditor/Actions.h +++ b/src/cascadia/TerminalSettingsEditor/Actions.h @@ -26,8 +26,8 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation ModifyKeyBindingEventArgs(const Control::KeyChord& oldKeys, const Control::KeyChord& newKeys, const hstring oldActionName, const hstring newActionName) : _OldKeys{ oldKeys }, _NewKeys{ newKeys }, - _OldActionName{ oldActionName }, - _NewActionName{ newActionName } {} + _OldActionName{ std::move(oldActionName) }, + _NewActionName{ std::move(newActionName) } {} WINRT_PROPERTY(Control::KeyChord, OldKeys, nullptr); WINRT_PROPERTY(Control::KeyChord, NewKeys, nullptr); @@ -38,7 +38,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation struct KeyBindingViewModel : KeyBindingViewModelT, ViewModelHelper { public: - KeyBindingViewModel(const Control::KeyChord& keys, const hstring name, const Windows::Foundation::Collections::IObservableVector& availableActions); + KeyBindingViewModel(const Control::KeyChord& keys, const hstring& name, const Windows::Foundation::Collections::IObservableVector& availableActions); hstring Name() const { return _CurrentAction; } hstring KeyChordText() const { return _KeyChordText; } diff --git a/src/cascadia/TerminalSettingsModel/ActionMap.cpp b/src/cascadia/TerminalSettingsModel/ActionMap.cpp index 3eaf90a5a2e..d9eb81be0a2 100644 --- a/src/cascadia/TerminalSettingsModel/ActionMap.cpp +++ b/src/cascadia/TerminalSettingsModel/ActionMap.cpp @@ -97,7 +97,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation return std::nullopt; } - static void RegisterShortcutAction(ShortcutAction shortcutAction, std::unordered_map& list, std::set& visited) + static void RegisterShortcutAction(ShortcutAction shortcutAction, std::unordered_map& list, std::unordered_set& visited) { const auto actionAndArgs{ make_self(shortcutAction) }; if (actionAndArgs->Action() != ShortcutAction::Invalid) @@ -122,7 +122,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation { // populate _AvailableActionsCache std::unordered_map availableActions; - std::set visitedActionIDs; + std::unordered_set visitedActionIDs; _PopulateAvailableActionsWithStandardCommands(availableActions, visitedActionIDs); // now add any ShortcutActions that we might have missed @@ -135,7 +135,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation return _AvailableActionsCache.GetView(); } - void ActionMap::_PopulateAvailableActionsWithStandardCommands(std::unordered_map& availableActions, std::set& visitedActionIDs) const + void ActionMap::_PopulateAvailableActionsWithStandardCommands(std::unordered_map& availableActions, std::unordered_set& visitedActionIDs) const { // Update AvailableActions and visitedActionIDs with our current layer for (const auto& [actionID, cmd] : _ActionMap) diff --git a/src/cascadia/TerminalSettingsModel/ActionMap.h b/src/cascadia/TerminalSettingsModel/ActionMap.h index 767e6b13858..797ad4b0f9f 100644 --- a/src/cascadia/TerminalSettingsModel/ActionMap.h +++ b/src/cascadia/TerminalSettingsModel/ActionMap.h @@ -83,7 +83,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation std::optional _GetActionByID(const InternalActionID actionID) const; std::optional _GetActionByKeyChordInternal(Control::KeyChord const& keys) const; - void _PopulateAvailableActionsWithStandardCommands(std::unordered_map& availableActions, std::set& visitedActionIDs) const; + void _PopulateAvailableActionsWithStandardCommands(std::unordered_map& availableActions, std::unordered_set& visitedActionIDs) const; void _PopulateNameMapWithSpecialCommands(std::unordered_map& nameMap) const; void _PopulateNameMapWithStandardCommands(std::unordered_map& nameMap) const; void _PopulateKeyBindingMapWithStandardCommands(std::unordered_map& keyBindingsMap, std::unordered_set& unboundKeys) const;