:chef_kiss:

This commit is contained in:
Mike Griese
2021-03-25 14:46:23 -05:00
parent fe5f3abf68
commit 330a8e823d
4 changed files with 15 additions and 2 deletions

View File

@@ -3398,7 +3398,9 @@ namespace winrt::TerminalApp::implementation
if (const auto scheme = _settings.GlobalSettings().ColorSchemes().TryLookup(args.SchemeName()))
{
// Get the settings of the focused control and stash them
_originalSettings = activeControl.Settings().as<TerminalSettings>();
auto controlSettings = activeControl.Settings().as<TerminalSettings>();
_originalSettings = controlSettings.GetParent();
// Create a new child for those settings
// auto childImpl = _originalSettings.CreateChild();
TerminalSettingsStruct fake{ _originalSettings, nullptr };
@@ -3408,7 +3410,7 @@ namespace winrt::TerminalApp::implementation
childStruct.DefaultSettings().ApplyColorScheme(scheme);
// Insert that new child as the parent of the control's settings
activeControl.Settings().as<TerminalSettings>().SetParent(childStruct.DefaultSettings());
controlSettings.SetParent(childStruct.DefaultSettings());
activeControl.UpdateSettings();
}
}

View File

@@ -205,6 +205,15 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
InsertParent(parentImpl);
}
Model::TerminalSettings TerminalSettings::GetParent()
{
if (_parents.size() > 0)
{
return *_parents.at(0);
}
return nullptr;
}
// Method Description:
// - Apply Profile settings, as well as any colors from our color scheme, if we have one.
// Arguments:

View File

@@ -58,6 +58,7 @@ namespace winrt::Microsoft::Terminal::Settings::Model::implementation
const Control::IKeyBindings& keybindings);
static Model::TerminalSettingsStruct CreateWithParent(const Model::TerminalSettingsStruct& parent);
Model::TerminalSettings GetParent();
void SetParent(const Model::TerminalSettings& parent);
void ApplyColorScheme(const Model::ColorScheme& scheme);

View File

@@ -31,6 +31,7 @@ namespace Microsoft.Terminal.Settings.Model
static TerminalSettingsStruct CreateWithParent(TerminalSettingsStruct parent);
void SetParent(TerminalSettings parent);
TerminalSettings GetParent();
void ApplyColorScheme(ColorScheme scheme);
};
}