forked from borisfaure/terminology
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmouse_reporting_mode_normal_ext_none.sh
More file actions
executable file
·168 lines (149 loc) · 3.26 KB
/
mouse_reporting_mode_normal_ext_none.sh
File metadata and controls
executable file
·168 lines (149 loc) · 3.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
#!/bin/sh
# shellcheck source=tests/utils.sh
. "$(dirname "$0")/utils.sh"
# char width: 7
# char height: 15
# resize window
#resize window to 180-chars width
printf '\033[8;;180;t'
# force render
printf '\033}tr\0'
test_sleep 0.2
# fill space with E
printf '\033#8'
# set color
printf '\033[46;31;3m'
# positions used are;
# - 200;130 -> 9;29
# - 480;130 -> 9;69
# - 1230;130 -> 9;176
# indicate the positions to help testing
printf '\033[9;29H#'
printf '\033[9;69H#'
printf '\033[9;95H@' # after that one, MOUSE_X10 is not working
printf '\033[9;176H#'
# set mouse mode - normal mode - normal reporting
printf '\033[?1000h'
printf '\033[H'
## LEFT CLICK
# should print ^[[M =)^[[M#e)
# move cursor
printf '\033[1H'
# mouse down
printf '\033}td;200;130;1;0;0\0'
# mouse move
printf '\033}tm;480;130;0\0'
# mouse up
printf '\033}tu;480;130;1;0;0\0'
# mouse click at x:93 -> ^[[M ~)^[[M#~)
printf '\033}td;657;130;1;0;0\0'
printf '\033}tm;657;130;0\0'
printf '\033}tu;657;130;1;0;0\0'
# mouse click at x:94 -> ^[[M ^?)^[[M ^?)
printf '\033}td;664;130;1;0;0\0'
printf '\033}tm;664;130;0\0'
printf '\033}tu;664;130;1;0;0\0'
# mouse click at x:95 -> ^[[M )^[[M# )
printf '\033}td;671;130;1;0;0\0'
printf '\033}tm;671;130;0\0'
printf '\033}tu;671;130;1;0;0\0'
# mouse click at x:174 -> ^[[M )^[[M# )
printf '\033}td;1230;130;1;0;0\0'
printf '\033}tm;1230;130;0\0'
printf '\033}tu;1230;130;1;0;0\0'
# force render
printf '\033}tr\0'
test_sleep 0.2
## RIGHT CLICK
# should print ^[[M"=)^[[M#e)
# move cursor
printf '\033[2H'
# mouse down
printf '\033}td;200;130;3;0;0\0'
# mouse move
printf '\033}tm;480;130;0\0'
# mouse up
printf '\033}tu;480;130;3;0;0\0'
# force render
printf '\033}tr\0'
test_sleep 0.2
## MIDDLE CLICK
# should print ^[[M!=)^[[M#e)
# move cursor
printf '\033[3H'
# mouse down
printf '\033}td;200;130;2;0;0\0'
# mouse move
printf '\033}tm;480;130;0\0'
# mouse up
printf '\033}tu;480;130;2;0;0\0'
# force render
printf '\033}tr\0'
test_sleep 0.2
## WHEEL
# prints ^[[M`=)^[[Ma=)^[[M`e)^[[Mae)
# move cursor
printf '\033[4H'
# wheel up/down
printf '\033}tw;200;130;1;1;0\0'
printf '\033}tw;200;130;0;1;0\0'
printf '\033}tw;480;130;1;1;0\0'
printf '\033}tw;480;130;0;1;0\0'
# force render
printf '\033}tr\0'
test_sleep 0.2
##
# Same with Alt
##
printf '\033[6HWith Alt:'
## LEFT CLICK
# should print ^[[M(=)^[[M+e)
# move cursor
printf '\033[7H'
# mouse down
printf '\033}td;200;130;1;1;0\0'
# mouse move
printf '\033}tm;480;130;1\0'
# mouse up
printf '\033}tu;480;130;1;1;0\0'
# force render
printf '\033}tr\0'
test_sleep 0.2
## RIGHT CLICK
# should print ^[[M"=)^[[M#e)
# move cursor
printf '\033[8H'
# mouse down
printf '\033}td;200;130;3;1;0\0'
# mouse move
printf '\033}tm;480;130;1\0'
# mouse up
printf '\033}tu;480;130;3;1;0\0'
# force render
printf '\033}tr\0'
test_sleep 0.2
## MIDDLE CLICK
# should print ^[[M!=)
# move cursor
printf '\033[9H'
# mouse down
printf '\033}td;200;130;2;1;0\0'
# mouse move
printf '\033}tm;480;130;1\0'
# mouse up
printf '\033}tu;480;130;2;1;0\0'
# force render
printf '\033}tr\0'
test_sleep 0.2
## WHEEL
# prints ^[[Mh=)^[[Mi=)^[[Mhe)^[[Mie)
# move cursor
printf '\033[10H'
# wheel up/down
printf '\033}tw;200;130;1;1;1\0'
printf '\033}tw;200;130;0;1;1\0'
printf '\033}tw;480;130;1;1;1\0'
printf '\033}tw;480;130;0;1;1\0'
# force render
printf '\033}tr\0'
test_sleep 0.2