Skip to content

Commit

Permalink
chore(mouse): add extended sgr mode tests
Browse files Browse the repository at this point in the history
  • Loading branch information
aymanbagabas committed Nov 14, 2022
1 parent 2cb61de commit 8f42d2d
Show file tree
Hide file tree
Showing 3 changed files with 589 additions and 224 deletions.
8 changes: 4 additions & 4 deletions mouse.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"strings"
)

const x10ByteOffset = 32
const mouseX10ByteOffset = 32

// MouseMsg contains information about a mouse event and are sent to a programs
// update function when mouse activity occurs. Note that the mouse must first
Expand Down Expand Up @@ -281,8 +281,8 @@ func parseX10MouseEvents(buf []byte) ([]MouseEvent, error) {
m := parseMouseButton(int(v[0]), false)

// (1,1) is the upper left. We subtract 1 to normalize it to (0,0).
m.X = int(v[1]) - x10ByteOffset - 1
m.Y = int(v[2]) - x10ByteOffset - 1
m.X = int(v[1]) - mouseX10ByteOffset - 1
m.Y = int(v[2]) - mouseX10ByteOffset - 1

r = append(r, m)
}
Expand All @@ -296,7 +296,7 @@ func parseMouseButton(b int, isSGR bool) MouseEvent {
m.isSGR = isSGR
e := b
if !isSGR {
e -= x10ByteOffset
e -= mouseX10ByteOffset
}

const (
Expand Down

0 comments on commit 8f42d2d

Please sign in to comment.