Преглед изворни кода

Merge pull request #780 from BDisp/unix-changing-colors

Fixes #760. Avoiding creating unix driver again after call endwin.
Charlie Kindel пре 5 година
родитељ
комит
646b97dda7
1 измењених фајлова са 12 додато и 2 уклоњено
  1. 12 2
      Terminal.Gui/Core/Application.cs

+ 12 - 2
Terminal.Gui/Core/Application.cs

@@ -161,6 +161,9 @@ namespace Terminal.Gui {
 
 		internal static bool _initialized = false;
 
+		static IMainLoopDriver oldMainLoopDriver;
+		static ConsoleDriver oldDriver;		
+
 		/// <summary>
 		/// Initializes the Terminal.Gui application
 		/// </summary>
@@ -189,8 +192,15 @@ namespace Terminal.Gui {
 					mainLoopDriver = windowsDriver;
 					Driver = windowsDriver;
 				} else {
-					mainLoopDriver = new UnixMainLoop ();
-					Driver = new CursesDriver ();
+					if (oldMainLoopDriver == null && oldDriver == null) {
+						mainLoopDriver = new UnixMainLoop ();
+						Driver = new CursesDriver ();
+						oldMainLoopDriver = mainLoopDriver;
+						oldDriver = Driver;
+					} else {
+						mainLoopDriver = oldMainLoopDriver;
+						Driver = oldDriver;
+					}
 				}
 				Driver.Init (TerminalResized);
 				MainLoop = new MainLoop (mainLoopDriver);