mirror of
https://github.com/junegunn/fzf.git
synced 2026-08-16 20:58:03 +08:00
Fix horizontal mouse wheel being treated as vertical scroll
Close #4848
This commit is contained in:
+8
-5
@@ -905,12 +905,15 @@ func (r *LightRenderer) mouseSequence(sz *int) Event {
|
|||||||
down := rest[end] == 'M'
|
down := rest[end] == 'M'
|
||||||
|
|
||||||
scroll := 0
|
scroll := 0
|
||||||
if t >= 64 {
|
wheel := t >= 64
|
||||||
|
if wheel {
|
||||||
t -= 64
|
t -= 64
|
||||||
if t&0b1 == 1 {
|
// SGR wheel button codes: 64=up, 65=down, 66=left, 67=right
|
||||||
scroll = -1
|
switch t & 0b11 {
|
||||||
} else {
|
case 0:
|
||||||
scroll = 1
|
scroll = 1
|
||||||
|
case 1:
|
||||||
|
scroll = -1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -921,7 +924,7 @@ func (r *LightRenderer) mouseSequence(sz *int) Event {
|
|||||||
shift := t&0b00100 > 0
|
shift := t&0b00100 > 0
|
||||||
drag := t&0b100000 > 0 // 32
|
drag := t&0b100000 > 0 // 32
|
||||||
|
|
||||||
if scroll != 0 {
|
if wheel {
|
||||||
return Event{Mouse, 0, &MouseEvent{y, x, scroll, false, false, false, ctrl, alt, shift}}
|
return Event{Mouse, 0, &MouseEvent{y, x, scroll, false, false, false, ctrl, alt, shift}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user