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

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

View File

@ -157,7 +157,14 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
{ {
if (!_name.has_value() || _name.value() != value) if (!_name.has_value() || _name.value() != value)
{ {
_name = value; if (value.empty())
{
_name = std::nullopt;
}
else
{
_name = value;
}
} }
} }