Browse Source

Fixes #3729. ProcessContinuousButtonPressedAsync is using a stale MouseEvent. (#3730)

BDisp 11 months ago
parent
commit
40056a6f2c
1 changed files with 6 additions and 6 deletions
  1. 6 6
      Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

+ 6 - 6
Terminal.Gui/ConsoleDrivers/WindowsDriver.cs

@@ -1811,12 +1811,6 @@ internal class WindowsDriver : ConsoleDriver
         int delay = startDelay;
         while (_isButtonPressed)
         {
-            var me = new MouseEvent
-            {
-                Position = _pointMove,
-                Flags = mouseFlag
-            };
-
             // TODO: This makes ConsoleDriver dependent on Application, which is not ideal. This should be moved to Application.
             View view = Application.WantContinuousButtonPressedView;
 
@@ -1831,6 +1825,12 @@ internal class WindowsDriver : ConsoleDriver
             }
             await Task.Delay (delay);
 
+            var me = new MouseEvent
+            {
+                Position = _pointMove,
+                Flags = mouseFlag
+            };
+
             //Debug.WriteLine($"ProcessContinuousButtonPressedAsync: {view}");
             if (_isButtonPressed && (mouseFlag & MouseFlags.ReportMousePosition) == 0)
             {