From 460f1714fa88c4f651e9021503576d6f3344a18c Mon Sep 17 00:00:00 2001 From: BDisp Date: Wed, 11 May 2022 16:10:56 +0100 Subject: [PATCH] Adding Left to the WindowPositionEvent for eventual future use. --- Terminal.Gui/ConsoleDrivers/NetDriver.cs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/Terminal.Gui/ConsoleDrivers/NetDriver.cs b/Terminal.Gui/ConsoleDrivers/NetDriver.cs index 39cdd42ed..069b0ba67 100644 --- a/Terminal.Gui/ConsoleDrivers/NetDriver.cs +++ b/Terminal.Gui/ConsoleDrivers/NetDriver.cs @@ -196,7 +196,8 @@ namespace Terminal.Gui { if (Console.WindowTop != consoleDriver.Top) { // Top only working on Windows. var winPositionEv = new WindowPositionEvent () { - Top = Console.WindowTop + Top = Console.WindowTop, + Left = Console.WindowLeft }; inputResultQueue.Enqueue (new InputResult () { EventType = EventType.WindowPosition, @@ -1144,6 +1145,7 @@ namespace Terminal.Gui { public struct WindowPositionEvent { public int Top; + public int Left; public Point CursorPosition; } @@ -1174,11 +1176,11 @@ namespace Terminal.Gui { const int COLOR_BRIGHT_CYAN = 96; const int COLOR_BRIGHT_WHITE = 97; - int cols, rows, top; + int cols, rows, left, top; public override int Cols => cols; public override int Rows => rows; - public override int Left => 0; + public override int Left => left; public override int Top => top; public override bool HeightAsBuffer { get; set; } @@ -1805,8 +1807,10 @@ namespace Terminal.Gui { break; case NetEvents.EventType.WindowPosition: var newTop = inputEvent.WindowPositionEvent.Top; - if (HeightAsBuffer && top != newTop) { + var newLeft = inputEvent.WindowPositionEvent.Left; + if (HeightAsBuffer && (top != newTop || left != newLeft)) { top = newTop; + left = newLeft; Refresh (); } break; @@ -1824,6 +1828,7 @@ namespace Terminal.Gui { size = new Size (Math.Max (Min_WindowWidth, Console.WindowWidth), Console.WindowHeight); top = 0; + left = 0; } else { //largestWindowHeight = Math.Max (Console.BufferHeight, largestWindowHeight); largestWindowHeight = Console.BufferHeight;