@@ -950,21 +950,27 @@ namespace winrt::TerminalApp::implementation
950
950
void CommandPalette::SetActionMap (const Microsoft::Terminal::Settings::Model::IActionMapView& actionMap)
951
951
{
952
952
_actionMap = actionMap;
953
+ _setCommands ();
953
954
}
954
955
955
- void CommandPalette::SetCommands ( const Collections::IVector<Command>& actions )
956
+ void CommandPalette::_setCommands ( )
956
957
{
957
- _allCommands.Clear ();
958
- for (const auto & action : actions)
958
+ if (_actionMap)
959
959
{
960
- auto actionPaletteItem{ winrt::make<winrt::TerminalApp::implementation::ActionPaletteItem>(action) };
961
- auto filteredCommand{ winrt::make<FilteredCommand>(actionPaletteItem) };
962
- _allCommands.Append (filteredCommand);
963
- }
960
+ _allCommands.Clear ();
961
+ const auto expandedCommands{ _actionMap.ExpandedCommands () };
962
+ for (const auto & action : expandedCommands)
963
+ {
964
+ const auto keyChordText{ KeyChordSerialization::ToString (_actionMap.GetKeyBindingForAction (action.ID ())) };
965
+ auto actionPaletteItem{ winrt::make<winrt::TerminalApp::implementation::ActionPaletteItem>(action, keyChordText) };
966
+ auto filteredCommand{ winrt::make<FilteredCommand>(actionPaletteItem) };
967
+ _allCommands.Append (filteredCommand);
968
+ }
964
969
965
- if (Visibility () == Visibility::Visible && _currentMode == CommandPaletteMode::ActionMode)
966
- {
967
- _updateFilteredActions ();
970
+ if (Visibility () == Visibility::Visible && _currentMode == CommandPaletteMode::ActionMode)
971
+ {
972
+ _updateFilteredActions ();
973
+ }
968
974
}
969
975
}
970
976
@@ -1178,7 +1184,8 @@ namespace winrt::TerminalApp::implementation
1178
1184
for (const auto & nameAndCommand : parentCommand.NestedCommands ())
1179
1185
{
1180
1186
const auto action = nameAndCommand.Value ();
1181
- auto nestedActionPaletteItem{ winrt::make<winrt::TerminalApp::implementation::ActionPaletteItem>(action) };
1187
+ // nested commands cannot have keybinds bound to them, so just pass in the command and no keys
1188
+ auto nestedActionPaletteItem{ winrt::make<winrt::TerminalApp::implementation::ActionPaletteItem>(action, L" " ) };
1182
1189
auto nestedFilteredCommand{ winrt::make<FilteredCommand>(nestedActionPaletteItem) };
1183
1190
_currentNestedCommands.Append (nestedFilteredCommand);
1184
1191
}
0 commit comments