diff --git a/ansi/mouse.go b/ansi/mouse.go index 09dfe62b..eec77d41 100644 --- a/ansi/mouse.go +++ b/ansi/mouse.go @@ -83,8 +83,8 @@ func (b MouseButton) String() string { // // - The eighth bit indicates additional buttons. // -// If button is [MouseRelease], and motion is false, this returns a release -// event. If button is undefined, this function returns 0xff. +// If button is [MouseNone], and motion is false, this returns a release event. +// If button is undefined, this function returns 0xff. func (b MouseButton) Button(motion, shift, alt, ctrl bool) (m byte) { // mouse bit shifts const ( @@ -98,7 +98,7 @@ func (b MouseButton) Button(motion, shift, alt, ctrl bool) (m byte) { bitsMask = 0b0000_0011 ) - if b == MouseRelease { + if b == MouseNone { m = bitsMask } else if b >= MouseLeft && b <= MouseRight { m = byte(b - MouseLeft) diff --git a/ansi/mouse_test.go b/ansi/mouse_test.go index 35abfc08..542651e7 100644 --- a/ansi/mouse_test.go +++ b/ansi/mouse_test.go @@ -16,9 +16,15 @@ func TestMouseButton(t *testing.T) { cases := []test{ { name: "mouse release", - btn: MouseRelease, + btn: MouseNone, want: 0b0000_0011, }, + { + name: "mouse release with ctrl", + btn: MouseNone, + ctrl: true, + want: 0b0001_0011, + }, { name: "mouse left", btn: MouseLeft, @@ -177,7 +183,7 @@ func TestMouseSgr(t *testing.T) { }, { name: "mouse release", - btn: MouseRelease.Button(false, false, false, false), + btn: MouseNone.Button(false, false, false, false), x: 5, y: 5, release: true,