From 90a9d156599c1ee6634230f21f466e7297c85a0e Mon Sep 17 00:00:00 2001 From: Carlos Zamora Date: Thu, 10 Oct 2024 17:11:51 -0700 Subject: [PATCH] Fix hiding the icon when it's set to "none" (#18030) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The settings UI and settings model allow you to set the icon to "none" to hide the icon (you can actually see this effect in the settings UI when changing the value of the profile icon). However, during settings validation, "none" is considered a file path, which is then failed to be parsed, resulting in the icon being marked as invalid and immediately clearing the value. This PR fixes this issue by considering "none" to be an accepted value during validation. Related to #15843 Closes #17943 ## Validation Steps Performed When an icon is set to "none", ... ✅ no more warning ✅ the icon is hidden (cherry picked from commit 36f064cfc8c06980af94a7ad6566d8df87d24ab1) Service-Card-Id: PVTI_lADOAF3p4s4AmhmszgTyV8A Service-Version: 1.21 --- src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp index e22905d3652..8d2ba573102 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp @@ -531,7 +531,9 @@ void CascadiaSettings::_validateMediaResources() // Explicitly just use the Icon here, not the EvaluatedIcon. We don't // want to blow up if we fell back to the commandline and the // commandline _isn't an icon_. - if (const auto icon = profile.Icon(); icon.size() > 2) + // GH #17943: "none" is a special value interpreted as "remove the icon" + static constexpr std::wstring_view HideIconValue{ L"none" }; + if (const auto icon = profile.Icon(); icon.size() > 2 && icon != HideIconValue) { const auto iconPath{ wil::ExpandEnvironmentStringsW(icon.c_str()) }; try