Skip to content

Commit

Permalink
fixes #574 Mouse wheel events during click-drag misdelivered as butto…
Browse files Browse the repository at this point in the history
…n events
  • Loading branch information
gdamore committed Oct 19, 2022
1 parent ede1dd5 commit d3cbfcf
Showing 1 changed file with 2 additions and 15 deletions.
17 changes: 2 additions & 15 deletions tscreen.go
Expand Up @@ -134,7 +134,6 @@ type tScreen struct {
clear bool
cursorx int
cursory int
wasbtn bool
acs map[rune]string
charset string
encoder transform.Transformer
Expand Down Expand Up @@ -1233,28 +1232,16 @@ func (t *tScreen) buildMouseEvent(x, y, btn int) *EventMouse {
switch btn & 0x43 {
case 0:
button = Button1
t.wasbtn = true
case 1:
button = Button3 // Note we prefer to treat right as button 2
t.wasbtn = true
case 2:
button = Button2 // And the middle button as button 3
t.wasbtn = true
case 3:
button = ButtonNone
t.wasbtn = false
case 0x40:
if !t.wasbtn {
button = WheelUp
} else {
button = Button1
}
button = WheelUp
case 0x41:
if !t.wasbtn {
button = WheelDown
} else {
button = Button2
}
button = WheelDown
}

if btn&0x4 != 0 {
Expand Down

0 comments on commit d3cbfcf

Please sign in to comment.