From 1426019f3eb9cc2a6b268df40e6570239846f68a Mon Sep 17 00:00:00 2001 From: BDisp Date: Tue, 17 Jan 2023 23:27:53 +0000 Subject: [PATCH] Fixes #2293. WindowsDriver forces minimum console height equal to 1, but should allow be 0. --- Terminal.Gui/ConsoleDrivers/WindowsDriver.cs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs index 66eeed296..4a200cc42 100644 --- a/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/WindowsDriver.cs @@ -251,9 +251,8 @@ namespace Terminal.Gui { throw new System.ComponentModel.Win32Exception (Marshal.GetLastWin32Error ()); } var winRect = new SmallRect (0, 0, (short)(newCols - 1), (short)Math.Max (newRows - 1, 0)); - if (!SetConsoleWindowInfo (ScreenBuffer, true, ref winRect)) { - //throw new System.ComponentModel.Win32Exception (Marshal.GetLastWin32Error ()); - return new Size (cols, rows); + if (!SetConsoleWindowInfo (OutputHandle, true, ref winRect)) { + throw new System.ComponentModel.Win32Exception (Marshal.GetLastWin32Error ()); } SetConsoleOutputWindow (csbi); return new Size (winRect.Right + 1, newRows - 1 < 0 ? 0 : winRect.Bottom + 1); @@ -261,7 +260,7 @@ namespace Terminal.Gui { void SetConsoleOutputWindow (CONSOLE_SCREEN_BUFFER_INFOEX csbi) { - if (ScreenBuffer != IntPtr.Zero && !SetConsoleScreenBufferInfoEx (OutputHandle, ref csbi)) { + if (ScreenBuffer != IntPtr.Zero && !SetConsoleScreenBufferInfoEx (ScreenBuffer, ref csbi)) { throw new System.ComponentModel.Win32Exception (Marshal.GetLastWin32Error ()); } } @@ -773,7 +772,7 @@ namespace Terminal.Gui { w += 3; } var newSize = WinConsole.SetConsoleWindow ( - (short)Math.Max (w, 16), (short)Math.Max (e.Height, 1)); + (short)Math.Max (w, 16), (short)Math.Max (e.Height, 0)); left = 0; top = 0; cols = newSize.Width;