name fixes

This commit is contained in:
Pankaj Bhojwani 2025-06-18 15:53:48 -07:00
parent c24293cd89
commit ad0f79dbb8
2 changed files with 12 additions and 3 deletions

View File

@ -265,10 +265,12 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation
}
void CommandViewModel::Name(const winrt::hstring& newName)
{
if (!newName.empty())
{
_command.Name(newName);
if (newName.empty())
{
// if the name was cleared, refresh the DisplayName
_NotifyChanges(L"DisplayName");
}
}

View File

@ -156,10 +156,17 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
void Command::Name(const hstring& value)
{
if (!_name.has_value() || _name.value() != value)
{
if (value.empty())
{
_name = std::nullopt;
}
else
{
_name = value;
}
}
}
hstring Command::IconPath() const noexcept
{