This commit is contained in:
Tig
2024-11-22 21:25:51 -07:00
parent bd42d79ba0
commit 5e9535c964
3 changed files with 7 additions and 22 deletions

View File

@@ -250,12 +250,6 @@ public static class ConfigurationManager
Reset ();
}
// Deafult is always loaded by Reset, so only load it if reset is false
if (!reset && Locations.HasFlag (ConfigLocations.Default))
{
Settings?.UpdateFromResource (typeof (ConfigurationManager).Assembly, $"Terminal.Gui.Resources.{_configFilename}");
}
if (Locations.HasFlag (ConfigLocations.GlobalCurrent))
{
Settings?.Update ($"./.tui/{_configFilename}");
@@ -295,6 +289,8 @@ public static class ConfigurationManager
{
Settings?.Update (Memory, "ConfigurationManager.Memory");
}
ThemeManager.SelectedTheme = Settings!["Theme"].PropertyValue as string ?? "Default";
}
/// <summary>

View File

@@ -110,7 +110,9 @@ public class ThemeManager : IDictionary<string, ThemeScope>
string oldTheme = _theme;
_theme = value;
if ((oldTheme != _theme || oldTheme != Settings! ["Theme"].PropertyValue as string) && Settings! ["Themes"]?.PropertyValue is Dictionary<string, ThemeScope> themes && themes.ContainsKey (_theme))
if ((oldTheme != _theme
|| oldTheme != Settings! ["Theme"].PropertyValue as string)
&& Settings! ["Themes"]?.PropertyValue is Dictionary<string, ThemeScope> themes && themes.ContainsKey (_theme))
{
Settings! ["Theme"].PropertyValue = _theme;
Instance.OnThemeChanged (oldTheme);
@@ -148,7 +150,7 @@ public class ThemeManager : IDictionary<string, ThemeScope>
internal static void Reset ()
{
Debug.WriteLine ("Themes.Reset()");
Colors.Reset ();
Colors.Reset ();
Themes?.Clear ();
SelectedTheme = string.Empty;
}

View File

@@ -161,7 +161,7 @@ public class ConfigurationManagerTests
dict.Add (new (DeepCopyTest.key), "Esc");
Assert.Contains (Key.Esc, dict);
DeepMemberWiseCopy (Key.Q.WithCtrl, DeepCopyTest.key);
DeepCopyTest.key = (Key)DeepMemberWiseCopy (Key.Q.WithCtrl, DeepCopyTest.key);
Assert.Equal (Key.Q.WithCtrl, DeepCopyTest.key);
Assert.Equal (Key.Esc, dict.Keys.ToArray () [0]);
@@ -178,19 +178,6 @@ public class ConfigurationManagerTests
Assert.True (dict.ContainsKey (Key.Q.WithCtrl));
}
//[Fact]
//public void Illustrate_DeepMemberWiseCopy_ ()
//{
// Assert.Equal (Key.Esc, Application.QuitKey);
// var o = UpdateValueFrom (Application.QuitKey);
// DeepMemberWiseCopy (Key.Q.WithCtrl, Application.QuitKey);
// Assert.Equal (Key.Q.WithCtrl, Application.QuitKey);
// Application.ResetState (true);
//}
[Fact]
public void Load_Raises_Updated ()
{