Fix wheel event detection

This commit is contained in:
Kovid Goyal 2023-03-27 16:35:29 +05:30
parent e85473cee6
commit 71580a2a93
No known key found for this signature in database
GPG Key ID: 06BC317B515ACE7C

View File

@ -7,6 +7,7 @@ import (
"strconv"
"strings"
"kitty/tools/tty"
"kitty/tools/utils"
)
@ -44,7 +45,7 @@ const (
)
const NONE, LEFT, MIDDLE, RIGHT, FOURTH, FIFTH, SIXTH, SEVENTH MouseButtonFlag = 0, 1, 2, 4, 8, 16, 32, 64
const WHEEL_UP, WHEEL_DOWN, WHEEL_LEFT, WHEEL_RIGHT MouseButtonFlag = -1, -2, -4, -8
const WHEEL_UP, WHEEL_DOWN, WHEEL_LEFT, WHEEL_RIGHT MouseButtonFlag = 128, 256, 512, 1024
var bmap = [...]MouseButtonFlag{LEFT, MIDDLE, RIGHT}
var ebmap = [...]MouseButtonFlag{FOURTH, FIFTH, SIXTH, SEVENTH}
@ -99,6 +100,8 @@ func pixel_to_cell(px, length, cell_length int) int {
return px / cell_length
}
var DebugPrintln = tty.DebugPrintln
func decode_sgr_mouse(text string, screen_size ScreenSize) *MouseEvent {
last_letter := text[len(text)-1]
text = text[:len(text)-1]