mirror of
https://github.com/gui-cs/Terminal.Gui.git
synced 2026-01-01 08:50:25 +01:00
Fixes #786. Workaround for resizing with Init/Shutdown.
This commit is contained in:
@@ -495,13 +495,30 @@ namespace Terminal.Gui {
|
||||
public override int Rows => rows;
|
||||
|
||||
public WindowsDriver ()
|
||||
{
|
||||
Initialize ();
|
||||
}
|
||||
|
||||
public WindowsDriver (int cols, int rows)
|
||||
{
|
||||
this.cols = cols;
|
||||
this.rows = rows;
|
||||
|
||||
Initialize ();
|
||||
}
|
||||
|
||||
void Initialize ()
|
||||
{
|
||||
winConsole = new WindowsConsole ();
|
||||
|
||||
SetupColorsAndBorders ();
|
||||
|
||||
cols = Console.WindowWidth;
|
||||
rows = Console.WindowHeight;
|
||||
if (cols == 0 && rows == 0) {
|
||||
cols = Console.WindowWidth;
|
||||
rows = Console.WindowHeight;
|
||||
} else {
|
||||
Console.SetWindowSize (cols, rows);
|
||||
}
|
||||
WindowsConsole.SmallRect.MakeEmpty (ref damageRegion);
|
||||
|
||||
ResizeScreen ();
|
||||
|
||||
@@ -161,8 +161,9 @@ namespace Terminal.Gui {
|
||||
|
||||
internal static bool _initialized = false;
|
||||
|
||||
static int cols, rows;
|
||||
static IMainLoopDriver oldMainLoopDriver;
|
||||
static ConsoleDriver oldDriver;
|
||||
static ConsoleDriver oldDriver;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes the Terminal.Gui application
|
||||
@@ -188,7 +189,7 @@ namespace Terminal.Gui {
|
||||
mainLoopDriver = new NetMainLoop (() => Console.ReadKey (true));
|
||||
Driver = new NetDriver ();
|
||||
} else if (p == PlatformID.Win32NT || p == PlatformID.Win32S || p == PlatformID.Win32Windows) {
|
||||
var windowsDriver = new WindowsDriver ();
|
||||
var windowsDriver = cols == 0 && rows == 0 ? new WindowsDriver () : new WindowsDriver (cols, rows);
|
||||
mainLoopDriver = windowsDriver;
|
||||
Driver = windowsDriver;
|
||||
} else {
|
||||
@@ -556,6 +557,8 @@ namespace Terminal.Gui {
|
||||
}
|
||||
last?.PositionCursor ();
|
||||
Driver.Refresh ();
|
||||
cols = Driver.Cols;
|
||||
rows = Driver.Rows;
|
||||
}
|
||||
|
||||
internal static void End (View view, bool closeDriver = true)
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace UICatalog {
|
||||
public virtual void Run ()
|
||||
{
|
||||
// This method already performs a later automatic shutdown.
|
||||
Application.Run (Top, false);
|
||||
Application.Run (Top);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -127,7 +127,7 @@ namespace UICatalog {
|
||||
Application.UseSystemConsole = false;
|
||||
Application.Init ();
|
||||
|
||||
// Set this here because not initilzied until driver is loaded
|
||||
// Set this here because not initialized until driver is loaded
|
||||
_baseColorScheme = Colors.Base;
|
||||
|
||||
StringBuilder aboutMessage = new StringBuilder ();
|
||||
@@ -235,7 +235,7 @@ namespace UICatalog {
|
||||
}
|
||||
};
|
||||
|
||||
Application.Run (_top, true);
|
||||
Application.Run (_top);
|
||||
Application.Shutdown ();
|
||||
return _runningScenario;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user