浏览代码

Trying fixing #1099. UI Catalog doesn't work on Windows Terminal.

BDisp 4 年之前
父节点
当前提交
eb6e28efd8
共有 2 个文件被更改,包括 5 次插入3 次删除
  1. 4 2
      Terminal.Gui/ConsoleDrivers/WindowsDriver.cs
  2. 1 1
      UICatalog/UICatalog.cs

+ 4 - 2
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -1558,9 +1558,11 @@ namespace Terminal.Gui {
 			Size SetWindowSize (System.Drawing.Rectangle rect)
 			{
 				var fontHDividerW = fontSize.FontHeight / fontSize.FontWidth;
+				var w = (rect.Width - rect.X) / fontSize.FontWidth;
+				var h = (rect.Height - rect.Y) / fontSize.FontHeight;
 
-				return new Size (Math.Max (((rect.Width - rect.X) / fontSize.FontWidth) - (fontHDividerW * 3), 0),
-					Math.Max (((rect.Height - rect.Y) / fontSize.FontHeight) - fontHDividerW - 1, 0));
+				return new Size (Math.Max ((w) - (fontHDividerW * 3) - (w < (Console.LargestWindowWidth / 2) ? -1 : 2), 0),
+					Math.Max ((h) - fontHDividerW - (w < (Console.LargestWindowHeight / 2) ? -1 : 1), 0));
 			}
 
 			bool IsDockedToMonitor (IntPtr hWnd, WindowsConsole.WindowPlacement placement)

+ 1 - 1
UICatalog/UICatalog.cs

@@ -63,7 +63,7 @@ namespace UICatalog {
 		private static Scenario _runningScenario = null;
 		private static bool _useSystemConsole = false;
 		private static ConsoleDriver.DiagnosticFlags _diagnosticFlags;
-		private static bool _heightAsBuffer = true;
+		private static bool _heightAsBuffer = false;
 		private static bool _alwaysSetPosition;
 
 		static void Main (string [] args)