diff --git a/src/cascadia/TerminalSettingsEditor/LaunchViewModel.cpp b/src/cascadia/TerminalSettingsEditor/LaunchViewModel.cpp index dc863292c6a..f1d61bce7fd 100644 --- a/src/cascadia/TerminalSettingsEditor/LaunchViewModel.cpp +++ b/src/cascadia/TerminalSettingsEditor/LaunchViewModel.cpp @@ -332,7 +332,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation // from menus, but still work as the startup profile for instance. for (const auto& profile : allProfiles) { - if (!profile.Deleted()) + if (!profile.Deleted() && !profile.Orphaned() /* BACKPORT GH#18188 - DO NOT DISPLAY ORPHANED PROFILES */) { profiles.emplace_back(profile); } diff --git a/src/cascadia/TerminalSettingsEditor/MainPage.cpp b/src/cascadia/TerminalSettingsEditor/MainPage.cpp index 6ffe49eb595..779c2d5fc7d 100644 --- a/src/cascadia/TerminalSettingsEditor/MainPage.cpp +++ b/src/cascadia/TerminalSettingsEditor/MainPage.cpp @@ -525,7 +525,7 @@ namespace winrt::Microsoft::Terminal::Settings::Editor::implementation // profile changes. for (const auto& profile : _settingsClone.AllProfiles()) { - if (!profile.Deleted()) + if (!profile.Deleted() && !profile.Orphaned() /* BACKPORT GH#18188 - DO NOT DISPLAY ORPHANED PROFILES */) { auto profileVM = _viewModelForProfile(profile, _settingsClone); profileVM.SetupAppearances(_colorSchemesPageVM.AllColorSchemes()); diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp index 8d2ba573102..5c075bf27d1 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp @@ -103,7 +103,7 @@ Model::CascadiaSettings CascadiaSettings::Copy() const for (const auto& profile : targetProfiles) { allProfiles.emplace_back(*profile); - if (!profile->Hidden()) + if (!profile->Hidden() && !profile->Orphaned()) { activeProfiles.emplace_back(*profile); } diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp index e988cb5dbda..10029ece3f4 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp @@ -1208,12 +1208,12 @@ CascadiaSettings::CascadiaSettings(SettingsLoader&& loader) : const auto& parents = profile->Parents(); if (std::none_of(parents.begin(), parents.end(), [&](const auto& parent) { return parent->Source() == source; })) { - continue; + profile->Orphaned(true); } } allProfiles.emplace_back(*profile); - if (!profile->Hidden()) + if (!profile->Hidden() && !profile->Orphaned()) { activeProfiles.emplace_back(*profile); } diff --git a/src/cascadia/TerminalSettingsModel/Profile.cpp b/src/cascadia/TerminalSettingsModel/Profile.cpp index 66382c857b1..0937c1a0441 100644 --- a/src/cascadia/TerminalSettingsModel/Profile.cpp +++ b/src/cascadia/TerminalSettingsModel/Profile.cpp @@ -103,6 +103,7 @@ winrt::com_ptr Profile::CopySettings() const const auto defaultAppearance = AppearanceConfig::CopyAppearance(winrt::get_self(_DefaultAppearance), weakProfile); profile->_Deleted = _Deleted; + profile->_Orphaned = _Orphaned; profile->_Updates = _Updates; profile->_Guid = _Guid; profile->_Name = _Name; diff --git a/src/cascadia/TerminalSettingsModel/Profile.h b/src/cascadia/TerminalSettingsModel/Profile.h index 6fdd5c3ed57..6f79c0cda3b 100644 --- a/src/cascadia/TerminalSettingsModel/Profile.h +++ b/src/cascadia/TerminalSettingsModel/Profile.h @@ -113,6 +113,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation void Icon(const hstring& value); WINRT_PROPERTY(bool, Deleted, false); + WINRT_PROPERTY(bool, Orphaned, false); WINRT_PROPERTY(OriginTag, Origin, OriginTag::None); WINRT_PROPERTY(guid, Updates); diff --git a/src/cascadia/TerminalSettingsModel/Profile.idl b/src/cascadia/TerminalSettingsModel/Profile.idl index 2d6d1ab609c..ddaa356dec6 100644 --- a/src/cascadia/TerminalSettingsModel/Profile.idl +++ b/src/cascadia/TerminalSettingsModel/Profile.idl @@ -41,6 +41,8 @@ namespace Microsoft.Terminal.Settings.Model // True if the user explicitly removed this Profile from settings.json. Boolean Deleted { get; }; + // True if the user *kept* this Profile, but it disappeared from the system. + Boolean Orphaned { get; }; // Helper for magically using a commandline for an icon for a profile // without an explicit icon.