From 587e70e838b616f4152330a08980096afdaebef0 Mon Sep 17 00:00:00 2001 From: Doneen Hesse Date: Thu, 15 Apr 2021 13:05:52 -0400 Subject: [PATCH 1/5] Comment indicating where implementing issue --- src/cascadia/TerminalSettingsModel/TerminalSettings.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp index b4518546bbd..0625e8e5dec 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp @@ -153,6 +153,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation _CursorHeight = appearance.CursorHeight(); if (!appearance.ColorSchemeName().empty()) { + // TODO: Edit this scheme to apply a random scheme if (const auto scheme = schemes.TryLookup(appearance.ColorSchemeName())) { ApplyColorScheme(scheme); From 1dea742433f070a09f952cef379e4e8c92f1194d Mon Sep 17 00:00:00 2001 From: Doneen Hesse Date: Thu, 22 Apr 2021 12:33:23 -0400 Subject: [PATCH 2/5] trying to find where error handling --- src/cascadia/TerminalApp/AppActionHandlers.cpp | 10 ++++++++++ .../CascadiaSettingsSerialization.cpp | 7 +++++++ .../TerminalSettingsModel/TerminalSettings.cpp | 14 ++++++++++++++ 3 files changed, 31 insertions(+) diff --git a/src/cascadia/TerminalApp/AppActionHandlers.cpp b/src/cascadia/TerminalApp/AppActionHandlers.cpp index 87aa865335e..9f69b40267d 100644 --- a/src/cascadia/TerminalApp/AppActionHandlers.cpp +++ b/src/cascadia/TerminalApp/AppActionHandlers.cpp @@ -388,6 +388,16 @@ namespace winrt::TerminalApp::implementation activeControl.UpdateSettings(); args.Handled(true); } + else if (realArgs.SchemeName() == winrt::to_hstring(L"_random")) + { + if (const auto scheme = _settings.GlobalSettings().ColorSchemes().TryLookup(L"Campbell")) + { + auto controlSettings = activeControl.Settings().as(); + controlSettings.ApplyColorScheme(scheme); + activeControl.UpdateSettings(); + args.Handled(true); + } + } } } } diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp index e63775a19f2..2eb2269e2f0 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp @@ -1092,6 +1092,13 @@ winrt::com_ptr CascadiaSettings::_FindMatchingColorScheme(const Jso { return winrt::get_self(scheme)->get_strong(); } + else if (*schemeName == winrt::to_hstring("_random")) + { + if (auto scheme{ _globals->ColorSchemes().TryLookup(L"Campbell") }) + { + return winrt::get_self(scheme)->get_strong(); + } + } } return nullptr; } diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp index 0625e8e5dec..635d92aba2b 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp @@ -141,6 +141,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation { defaultSettings.ApplyColorScheme(scheme); } + else if (newTerminalArgs.ColorScheme() == winrt::to_hstring(L"_random")) + { + if (const auto& scheme = schemes.TryLookup(L"Campbell")) + { + defaultSettings.ApplyColorScheme(scheme); + } + } } } @@ -158,6 +165,13 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation { ApplyColorScheme(scheme); } + // else if (std::strcmp(appearance.ColorSchemeName().c_str(), "_random")) + // else if (std::strcmp(appearance.ColorSchemeName().c_str(), "_random")) + else if (appearance.ColorSchemeName() == winrt::to_hstring(L"_random")) + { + const auto scheme = schemes.TryLookup(winrt::to_hstring(L"Tango Light")); + ApplyColorScheme(scheme); + } } if (appearance.Foreground()) { From efa6160baa2d0d452e346aed3b7abb177c8a920e Mon Sep 17 00:00:00 2001 From: Doneen Hesse Date: Thu, 22 Apr 2021 19:03:52 -0400 Subject: [PATCH 3/5] just added L to all strings --- .../TerminalSettingsModel/CascadiaSettingsSerialization.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp index 2eb2269e2f0..bf535fd4580 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettingsSerialization.cpp @@ -1092,7 +1092,7 @@ winrt::com_ptr CascadiaSettings::_FindMatchingColorScheme(const Jso { return winrt::get_self(scheme)->get_strong(); } - else if (*schemeName == winrt::to_hstring("_random")) + else if (*schemeName == winrt::to_hstring(L"_random")) { if (auto scheme{ _globals->ColorSchemes().TryLookup(L"Campbell") }) { From b2f1ec7c061c3155a38b68f6d0429e87c1b9416f Mon Sep 17 00:00:00 2001 From: Doneen Hesse Date: Fri, 23 Apr 2021 14:05:03 -0400 Subject: [PATCH 4/5] unfound color scheme warning still up? --- .../TerminalSettingsModel/CascadiaSettings.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp index 1cef8481b06..2651f87f60c 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp @@ -550,10 +550,10 @@ void CascadiaSettings::_ValidateAllSchemesExist() } } - if (foundInvalidScheme) - { - _warnings.Append(SettingsLoadWarnings::UnknownColorScheme); - } + // if (foundInvalidScheme) + // { + // _warnings.Append(SettingsLoadWarnings::UnknownColorScheme); + // } } // Method Description: @@ -789,14 +789,15 @@ void CascadiaSettings::_ValidateColorSchemesInCommands() } } - if (foundInvalidScheme) - { - _warnings.Append(SettingsLoadWarnings::InvalidColorSchemeInCmd); - } + // if (foundInvalidScheme) + // { + // _warnings.Append(SettingsLoadWarnings::InvalidColorSchemeInCmd); + // } } bool CascadiaSettings::_HasInvalidColorScheme(const Model::Command& command) { + return false; bool invalid{ false }; if (command.HasNestedCommands()) { From 947214349b930348dc078bb1111c2d513756a380 Mon Sep 17 00:00:00 2001 From: Doneen Hesse Date: Fri, 23 Apr 2021 15:06:28 -0400 Subject: [PATCH 5/5] removing all warnings in file does not stop popup --- .../CascadiaSettings.cpp | 76 ++++++++++--------- .../TerminalSettings.cpp | 2 - 2 files changed, 42 insertions(+), 36 deletions(-) diff --git a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp index 2651f87f60c..d5664841c69 100644 --- a/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/CascadiaSettings.cpp @@ -261,7 +261,11 @@ void CascadiaSettings::ClearWarnings() void CascadiaSettings::AppendWarning(SettingsLoadWarnings warning) { - _warnings.Append(warning); + warning = warning; + int i = 0; + ++i; + return; + // _warnings.Append(warning); } winrt::Windows::Foundation::IReference CascadiaSettings::GetLoadingError() @@ -382,15 +386,15 @@ void CascadiaSettings::_ValidateDefaultProfileExists() } } - if (nullDefaultProfile || defaultProfileNotInProfiles) - { - _warnings.Append(Microsoft::Terminal::Settings::Model::SettingsLoadWarnings::MissingDefaultProfile); - // Use the first profile as the new default + // if (nullDefaultProfile || defaultProfileNotInProfiles) + // { + // _warnings.Append(Microsoft::Terminal::Settings::Model::SettingsLoadWarnings::MissingDefaultProfile); + // // Use the first profile as the new default - // _temporarily_ set the default profile to the first profile. Because - // we're adding a warning, this settings change won't be re-serialized. - GlobalSettings().DefaultProfile(_allProfiles.GetAt(0).Guid()); - } + // // _temporarily_ set the default profile to the first profile. Because + // // we're adding a warning, this settings change won't be re-serialized. + // GlobalSettings().DefaultProfile(_allProfiles.GetAt(0).Guid()); + // } } // Method Description: @@ -425,10 +429,10 @@ void CascadiaSettings::_ValidateNoDuplicateProfiles() _allProfiles.RemoveAt(*iter); } - if (foundDupe) - { - _warnings.Append(Microsoft::Terminal::Settings::Model::SettingsLoadWarnings::DuplicateProfile); - } + // if (foundDupe) + // { + // _warnings.Append(Microsoft::Terminal::Settings::Model::SettingsLoadWarnings::DuplicateProfile); + // } } // Method Description: @@ -630,15 +634,15 @@ void CascadiaSettings::_ValidateMediaResources() } } - if (invalidBackground) - { - _warnings.Append(SettingsLoadWarnings::InvalidBackgroundImage); - } + // if (invalidBackground) + // { + // _warnings.Append(SettingsLoadWarnings::InvalidBackgroundImage); + // } - if (invalidIcon) - { - _warnings.Append(SettingsLoadWarnings::InvalidIcon); - } + // if (invalidIcon) + // { + // _warnings.Append(SettingsLoadWarnings::InvalidIcon); + // } } // Method Description: @@ -758,15 +762,16 @@ std::optional CascadiaSettings::_GetProfileGuidByIndex(std::optiona void CascadiaSettings::_ValidateKeybindings() { auto keybindingWarnings = _globals->KeybindingsWarnings(); + return; - if (!keybindingWarnings.empty()) - { - _warnings.Append(SettingsLoadWarnings::AtLeastOneKeybindingWarning); - for (auto warning : keybindingWarnings) - { - _warnings.Append(warning); - } - } + // if (!keybindingWarnings.empty()) + // { + // _warnings.Append(SettingsLoadWarnings::AtLeastOneKeybindingWarning); + // for (auto warning : keybindingWarnings) + // { + // _warnings.Append(warning); + // } + // } } // Method Description: @@ -841,11 +846,14 @@ bool CascadiaSettings::_HasInvalidColorScheme(const Model::Command& command) // we find any invalid background images. void CascadiaSettings::_ValidateNoGlobalsKey() { - // use isMember here. If you use [], you're actually injecting "globals": null. - if (_userSettings.isMember("globals")) - { - _warnings.Append(SettingsLoadWarnings::LegacyGlobalsProperty); - } + int i = 0; + ++i; + return; + // // use isMember here. If you use [], you're actually injecting "globals": null. + // if (_userSettings.isMember("globals")) + // { + // _warnings.Append(SettingsLoadWarnings::LegacyGlobalsProperty); + // } } // Method Description diff --git a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp index 635d92aba2b..4c706fee9e3 100644 --- a/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp +++ b/src/cascadia/TerminalSettingsModel/TerminalSettings.cpp @@ -165,8 +165,6 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation { ApplyColorScheme(scheme); } - // else if (std::strcmp(appearance.ColorSchemeName().c_str(), "_random")) - // else if (std::strcmp(appearance.ColorSchemeName().c_str(), "_random")) else if (appearance.ColorSchemeName() == winrt::to_hstring(L"_random")) { const auto scheme = schemes.TryLookup(winrt::to_hstring(L"Tango Light"));