mirror of
https://github.com/microsoft/terminal.git
synced 2026-02-08 05:37:27 +00:00
:chef_kiss:
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -31,6 +31,7 @@ namespace Microsoft.Terminal.Settings.Model
|
||||
static TerminalSettingsStruct CreateWithParent(TerminalSettingsStruct parent);
|
||||
|
||||
void SetParent(TerminalSettings parent);
|
||||
TerminalSettings GetParent();
|
||||
void ApplyColorScheme(ColorScheme scheme);
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user