@@ -63,8 +63,10 @@ func TestSGRMouse(t *testing.T) {
6363 testSGRMouseInput (t , "\x1b [<64;10;10M" )
6464 // Wheel down
6565 testSGRMouseInput (t , "\x1b [<65;10;10M" )
66- // Motion with left button
66+ // Motion with left button (drag)
6767 testSGRMouseInput (t , "\x1b [<32;15;25M" )
68+ // Motion without button
69+ testSGRMouseInput (t , "\x1b [<35;15;25M" )
6870 // Ctrl+left click
6971 testSGRMouseInput (t , "\x1b [<16;5;5M" )
7072 // Alt+left click
@@ -75,7 +77,8 @@ func TestSGRMouse(t *testing.T) {
7577
7678func TestMouseFiltering (t * testing.T ) {
7779 press := Mouse {Type : MousePress , Button : MouseLeft , Down : true }
78- motion := Mouse {Type : MouseMotion , Down : true }
80+ drag := Mouse {Type : MouseMotion , Button : MouseLeft , Down : true }
81+ motion := Mouse {Type : MouseMotion , Down : false }
7982
8083 // No mouse mode → not reported.
8184 _ , ok := press .Bytes (0 )
@@ -84,16 +87,28 @@ func TestMouseFiltering(t *testing.T) {
8487 // X10 only reports presses.
8588 _ , ok = press .Bytes (emu .ModeMouseX10 )
8689 assert .True (t , ok )
87- _ , ok = motion .Bytes (emu .ModeMouseX10 )
90+ _ , ok = drag .Bytes (emu .ModeMouseX10 )
8891 assert .False (t , ok )
8992
90- // Button mode drops pure motion.
93+ // Button mode drops all motion.
9194 _ , ok = press .Bytes (emu .ModeMouseButton )
9295 assert .True (t , ok )
96+ _ , ok = drag .Bytes (emu .ModeMouseButton )
97+ assert .False (t , ok )
9398 _ , ok = motion .Bytes (emu .ModeMouseButton )
9499 assert .False (t , ok )
95100
101+ // Motion mode (1002) reports drag but not no-button motion.
102+ _ , ok = press .Bytes (emu .ModeMouseMotion )
103+ assert .True (t , ok )
104+ _ , ok = drag .Bytes (emu .ModeMouseMotion )
105+ assert .True (t , ok )
106+ _ , ok = motion .Bytes (emu .ModeMouseMotion )
107+ assert .False (t , ok )
108+
96109 // Many mode reports everything.
110+ _ , ok = drag .Bytes (emu .ModeMouseMany )
111+ assert .True (t , ok )
97112 _ , ok = motion .Bytes (emu .ModeMouseMany )
98113 assert .True (t , ok )
99114}
0 commit comments