Browse Source

Prevents negative values if the windows size change so quickly.

BDisp 4 years ago
parent
commit
a4b19b05b8
1 changed files with 3 additions and 1 deletions
  1. 3 1
      Terminal.Gui/ConsoleDrivers/NetDriver.cs

+ 3 - 1
Terminal.Gui/ConsoleDrivers/NetDriver.cs

@@ -177,7 +177,9 @@ namespace Terminal.Gui {
 			while (true) {
 				if (!consoleDriver.HeightAsBuffer) {
 					if (Console.WindowWidth != consoleDriver.Cols || Console.WindowHeight != consoleDriver.Rows) {
-						GetWindowSizeEvent (new Size (Console.WindowWidth, Console.WindowHeight));
+						var w = Math.Max (Console.WindowWidth, 0);
+						var h = Math.Max (Console.WindowHeight, 0);
+						GetWindowSizeEvent (new Size (w, h));
 						return;
 					}
 				} else {