Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 10 additions & 8 deletions lib/src/core/mouse/button.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,21 +5,23 @@ enum TerminalMouseButton {

right(id: 2),

wheelUp(id: 64 + 4, isWheel: true),
wheelUp(id: 64 + 0, isWheel: true),

wheelDown(id: 64 + 5, isWheel: true),
wheelDown(id: 64 + 1, isWheel: true),

wheelLeft(id: 64 + 6, isWheel: true),
wheelLeft(id: 64 + 2, isWheel: true),

wheelRight(id: 64 + 7, isWheel: true),
wheelRight(id: 64 + 3, isWheel: true),
;

/// The id that is used to report a button press or release to the terminal.
///
/// Mouse wheel up / down use button IDs 4 = 0100 (binary) and 5 = 0101 (binary).
/// The bits three and four of the button are transposed by 64 and 128
/// respectively, when reporting the id of the button and have have to be
/// adjusted correspondingly.
/// Wheel buttons 4–7 are encoded with bit 6 set (add 64) and the button number
/// in the low two bits, giving 64 (up), 65 (down), 66 (left), 67 (right). The
/// button number is transposed into that bit — it is *not* added on top of 64,
/// or the extra bits read as spurious shift/meta modifiers (e.g. 64+5 = 69 =
/// wheel-down **+ shift**), which strict applications reject as an invalid wheel
/// event and ignore — the whole scroll then does nothing.
final int id;

/// Whether this button is a mouse wheel button.
Expand Down