浏览代码

A provisional solution to the #1065 issue. Setting HeightAsBuffer as true by default.

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

+ 18 - 1
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -592,7 +592,24 @@ namespace Terminal.Gui {
 		public override int Cols => cols;
 		public override int Rows => rows;
 		public override int Top => top;
-		public override bool HeightAsBuffer { get; set; }
+
+		bool heightAsBuffer;
+		public override bool HeightAsBuffer {
+			get => heightAsBuffer;
+			set {
+				heightAsBuffer = value;
+				if (heightAsBuffer) {
+					ResizeScreen ();
+					UpdateOffScreen ();
+					var bufferCoords = new WindowsConsole.Coord () {
+						X = (short)cols,
+						Y = (short)rows
+					};
+					winConsole.ReadFromConsoleOutput (new Size (cols, rows), bufferCoords, damageRegion);
+				}
+				Refresh ();
+			}
+		}
 
 		public WindowsConsole WinConsole {
 			get => winConsole;

+ 0 - 1
Terminal.Gui/Core/Application.cs

@@ -88,7 +88,6 @@ namespace Terminal.Gui {
 				}
 				if (Driver.HeightAsBuffer != value) {
 					Driver.HeightAsBuffer = value;
-					Driver.Refresh ();
 				}
 			}
 		}

+ 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;
+		private static bool _heightAsBuffer = true;
 		private static bool _alwaysSetPosition;
 
 		static void Main (string [] args)