Skip to content

Commit

Permalink
Merge pull request gui-cs#3341 from BDisp/v2_wheeledleft-wheeledright…
Browse files Browse the repository at this point in the history
…-fix_3340

Fixes gui-cs#3340. Mouse ButtonShift doesn't work anymore on Windows Terminal.
  • Loading branch information
tig authored Mar 21, 2024
2 parents 6badd0d + d2a2ff1 commit 37c8969
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
8 changes: 4 additions & 4 deletions Terminal.Gui/Input/Mouse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,11 @@ public enum MouseFlags
/// <summary>Vertical button wheeled down.</summary>
WheeledDown = 0x20000000,

/// <summary>Vertical button wheeled up while pressing ButtonShift.</summary>
WheeledLeft = ButtonShift | WheeledUp,
/// <summary>Vertical button wheeled up while pressing ButtonCtrl.</summary>
WheeledLeft = ButtonCtrl | WheeledUp,

/// <summary>Vertical button wheeled down while pressing ButtonShift.</summary>
WheeledRight = ButtonShift | WheeledDown,
/// <summary>Vertical button wheeled down while pressing ButtonCtrl.</summary>
WheeledRight = ButtonCtrl | WheeledDown,

/// <summary>Mask that captures all the events.</summary>
AllEvents = 0x7ffffff
Expand Down
13 changes: 13 additions & 0 deletions UnitTests/View/MouseTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,17 @@ public void ButtonPressed_In_Margin_Or_Border_Starts_Drag (int marginThickness,

Assert.Equal (expectedMoved, new Point (5, 5) == testView.Frame.Location);
}

[Theory]
[InlineData (MouseFlags.WheeledUp | MouseFlags.ButtonCtrl, MouseFlags.WheeledLeft)]
[InlineData (MouseFlags.WheeledDown | MouseFlags.ButtonCtrl, MouseFlags.WheeledRight)]
public void WheeledLeft_WheeledRight (MouseFlags mouseFlags, MouseFlags expectedMouseFlagsFromEvent)
{
MouseFlags mouseFlagsFromEvent = MouseFlags.None;
var view = new View ();
view.MouseEvent += (s, e) => mouseFlagsFromEvent = e.MouseEvent.Flags;

view.OnMouseEvent (new MouseEvent () { Flags = mouseFlags });
Assert.Equal (mouseFlagsFromEvent, expectedMouseFlagsFromEvent);
}
}

0 comments on commit 37c8969

Please sign in to comment.