proposed shortcut action name

This commit is contained in:
Pankaj Bhojwani 2025-06-18 14:47:09 -07:00
parent b23ce8735f
commit 43ad62c32d
4 changed files with 6 additions and 6 deletions

View File

@ -218,16 +218,16 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
_AvailableShortcutActions = single_threaded_observable_vector(std::move(shortcutActions));
const auto shortcutActionString = _AvailableActionsAndNamesMap.Lookup(_command.ActionAndArgs().Action());
ProposedShortcutAction(winrt::box_value(shortcutActionString));
ProposedShortcutActionName(winrt::box_value(shortcutActionString));
_CreateAndInitializeActionArgsVMHelper();
// Add a property changed handler to our own property changed event.
// This allows us to create a new ActionArgsVM when the shortcut action changes
PropertyChanged([this](auto&&, const PropertyChangedEventArgs& args) {
const auto viewModelProperty{ args.PropertyName() };
if (viewModelProperty == L"ProposedShortcutAction")
if (viewModelProperty == L"ProposedShortcutActionName")
{
const auto actionString = unbox_value<hstring>(ProposedShortcutAction());
const auto actionString = unbox_value<hstring>(ProposedShortcutActionName());
const auto actionEnum = _NameToActionMap.at(actionString);
const auto emptyArgs = ActionArgFactory::GetEmptyArgsForAction(actionEnum);
// todo: probably need some better default values for empty args

View File

@ -117,7 +117,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
til::typed_event<IInspectable, Editor::ArgWrapper> PropagateWindowRootRequested;
til::typed_event<IInspectable, IInspectable> FocusContainer;
VIEW_MODEL_OBSERVABLE_PROPERTY(IInspectable, ProposedShortcutAction);
VIEW_MODEL_OBSERVABLE_PROPERTY(IInspectable, ProposedShortcutActionName);
VIEW_MODEL_OBSERVABLE_PROPERTY(Editor::ActionArgsViewModel, ActionArgsVM, nullptr);
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<hstring>, AvailableShortcutActions, nullptr);
WINRT_PROPERTY(Windows::Foundation::Collections::IObservableVector<Editor::KeyChordViewModel>, KeyChordViewModelList, nullptr);

View File

@ -38,7 +38,7 @@ namespace Microsoft.Terminal.Settings.Editor
// UI side (edit command page)
IObservableVector<String> AvailableShortcutActions { get; };
Object ProposedShortcutAction;
Object ProposedShortcutActionName;
void Delete_Click();
void AddKeybinding_Click();
event Windows.Foundation.TypedEventHandler<Object, ArgWrapper> PropagateColorSchemeRequested;

View File

@ -657,7 +657,7 @@
VerticalAlignment="Center"
AutomationProperties.Name="{x:Bind ViewModel.ShortcutActionComboBoxAutomationPropName}"
ItemsSource="{x:Bind ViewModel.AvailableShortcutActions, Mode=OneWay}"
SelectedItem="{x:Bind ViewModel.ProposedShortcutAction, Mode=TwoWay}" />
SelectedItem="{x:Bind ViewModel.ProposedShortcutActionName, Mode=TwoWay}" />
<TextBlock x:Uid="Actions_Arguments"
Grid.Row="2"
Grid.Column="0"