wip
This commit is contained in:
@@ -39,6 +39,32 @@ func TestMatchCtrlK(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestParseSGRMouseWheel(t *testing.T) {
|
||||
cases := []struct {
|
||||
params string
|
||||
want int
|
||||
ok bool
|
||||
}{
|
||||
{"64;1;1", -3, true}, // wheel up
|
||||
{"65;1;1", 3, true}, // wheel down
|
||||
{"68;1;1", -3, true}, // shift+wheel up
|
||||
{"69;1;1", 3, true}, // shift+wheel down
|
||||
{"80;1;1", -3, true}, // ctrl+wheel up
|
||||
{"81;1;1", 3, true}, // ctrl+wheel down
|
||||
{"0;5;7", 0, false}, // left press
|
||||
{"2;5;7", 0, false}, // right press
|
||||
{"32;5;7", 0, false}, // drag
|
||||
{"", 0, false}, // empty
|
||||
{"abc;1;1", 0, false}, // garbage button
|
||||
}
|
||||
for _, c := range cases {
|
||||
got, ok := parseSGRMouseWheel([]byte(c.params))
|
||||
if ok != c.ok || got != c.want {
|
||||
t.Errorf("parseSGRMouseWheel(%q) = (%d,%v), want (%d,%v)", c.params, got, ok, c.want, c.ok)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func TestMatchCtrlKConsecutive(t *testing.T) {
|
||||
// Two kitty Ctrl-K sequences back to back, the chord case.
|
||||
chunk := []byte("\x1b[107;5u\x1b[107;5u")
|
||||
|
||||
Reference in New Issue
Block a user