update display name on argument change

This commit is contained in:
Pankaj Bhojwani 2025-06-24 15:03:15 -07:00
parent 2b086cbdf3
commit d682ded898

View File

@ -421,25 +421,21 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
} }
} }
}); });
if (_IsNewCommand)
{
// for new commands, make sure we generate a new ID every time any arg value changes
actionArgsVM.WrapperValueChanged([weakThis = get_weak()](const IInspectable& /*sender*/, const IInspectable& /*args*/) { actionArgsVM.WrapperValueChanged([weakThis = get_weak()](const IInspectable& /*sender*/, const IInspectable& /*args*/) {
if (auto weak = weakThis.get()) if (auto weak = weakThis.get())
{
// for new commands, make sure we generate a new ID every time any arg value changes
if (weak->_IsNewCommand)
{ {
weak->_command.GenerateID(); weak->_command.GenerateID();
} }
}); else if (!weak->IsUserAction())
}
else if (!IsUserAction())
{
actionArgsVM.WrapperValueChanged([weakThis = get_weak()](const IInspectable& /*sender*/, const IInspectable& /*args*/) {
if (auto weak = weakThis.get())
{ {
weak->_ReplaceCommandWithUserCopy(false); weak->_ReplaceCommandWithUserCopy(false);
} }
}); weak->_NotifyChanges(L"DisplayName");
} }
});
} }
void CommandViewModel::_ReplaceCommandWithUserCopy(bool reinitialize) void CommandViewModel::_ReplaceCommandWithUserCopy(bool reinitialize)