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
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
|
INIT
UTF8 1
WANTSTATE seb
!ICH
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "ACD"
PUSH "\e[2D"
?cursor = 0,1
PUSH "\e[@"
scrollrect 0..1,1..80 => +0,-1
?cursor = 0,1
PUSH "B"
?cursor = 0,2
PUSH "\e[3@"
scrollrect 0..1,2..80 => +0,-3
!ICH with DECSLRM
PUSH "\e[?69h"
PUSH "\e[;50s"
PUSH "\e[20G\e[@"
scrollrect 0..1,19..50 => +0,-1
!ICH outside DECSLRM
PUSH "\e[70G\e[@"
# nothing happens
!DCH
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "ABBC"
PUSH "\e[3D"
?cursor = 0,1
PUSH "\e[P"
scrollrect 0..1,1..80 => +0,+1
?cursor = 0,1
PUSH "\e[3P"
scrollrect 0..1,1..80 => +0,+3
?cursor = 0,1
!DCH with DECSLRM
PUSH "\e[?69h"
PUSH "\e[;50s"
PUSH "\e[20G\e[P"
scrollrect 0..1,19..50 => +0,+1
!DCH outside DECSLRM
PUSH "\e[70G\e[P"
# nothing happens
!ECH
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "ABC"
PUSH "\e[2D"
?cursor = 0,1
PUSH "\e[X"
erase 0..1,1..2
?cursor = 0,1
PUSH "\e[3X"
erase 0..1,1..4
?cursor = 0,1
# ECH more columns than there are should be bounded
PUSH "\e[100X"
erase 0..1,1..80
!IL
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "A\r\nC"
?cursor = 1,1
PUSH "\e[L"
scrollrect 1..25,0..80 => -1,+0
# TODO: ECMA-48 says we should move to line home, but neither xterm nor
# xfce4-terminal do this
?cursor = 1,1
PUSH "\rB"
?cursor = 1,1
PUSH "\e[3L"
scrollrect 1..25,0..80 => -3,+0
!IL with DECSTBM
PUSH "\e[5;15r"
PUSH "\e[5H\e[L"
scrollrect 4..15,0..80 => -1,+0
!IL outside DECSTBM
PUSH "\e[20H\e[L"
# nothing happens
!IL with DECSTBM+DECSLRM
PUSH "\e[?69h"
PUSH "\e[10;50s"
PUSH "\e[5;10H\e[L"
scrollrect 4..15,9..50 => -1,+0
!DL
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "A\r\nB\r\nB\r\nC"
?cursor = 3,1
PUSH "\e[2H"
?cursor = 1,0
PUSH "\e[M"
scrollrect 1..25,0..80 => +1,+0
?cursor = 1,0
PUSH "\e[3M"
scrollrect 1..25,0..80 => +3,+0
?cursor = 1,0
!DL with DECSTBM
PUSH "\e[5;15r"
PUSH "\e[5H\e[M"
scrollrect 4..15,0..80 => +1,+0
!DL outside DECSTBM
PUSH "\e[20H\e[M"
# nothing happens
!DL with DECSTBM+DECSLRM
PUSH "\e[?69h"
PUSH "\e[10;50s"
PUSH "\e[5;10H\e[M"
scrollrect 4..15,9..50 => +1,+0
!DECIC
RESET
erase 0..25,0..80
PUSH "\e[20G\e[5'}"
scrollrect 0..25,19..80 => +0,-5
!DECIC with DECSTBM+DECSLRM
PUSH "\e[?69h"
PUSH "\e[4;20r\e[20;60s"
PUSH "\e[4;20H\e[3'}"
scrollrect 3..20,19..60 => +0,-3
!DECIC outside DECSLRM
PUSH "\e[70G\e['}"
# nothing happens
!DECDC
RESET
erase 0..25,0..80
PUSH "\e[20G\e[5'~"
scrollrect 0..25,19..80 => +0,+5
!DECDC with DECSTBM+DECSLRM
PUSH "\e[?69h"
PUSH "\e[4;20r\e[20;60s"
PUSH "\e[4;20H\e[3'~"
scrollrect 3..20,19..60 => +0,+3
!DECDC outside DECSLRM
PUSH "\e[70G\e['~"
# nothing happens
!EL 0
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "ABCDE"
PUSH "\e[3D"
?cursor = 0,2
PUSH "\e[0K"
erase 0..1,2..80
?cursor = 0,2
!EL 1
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "ABCDE"
PUSH "\e[3D"
?cursor = 0,2
PUSH "\e[1K"
erase 0..1,0..3
?cursor = 0,2
!EL 2
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "ABCDE"
PUSH "\e[3D"
?cursor = 0,2
PUSH "\e[2K"
erase 0..1,0..80
?cursor = 0,2
!SEL
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "\e[11G"
?cursor = 0,10
PUSH "\e[?0K"
erase 0..1,10..80 selective
?cursor = 0,10
PUSH "\e[?1K"
erase 0..1,0..11 selective
?cursor = 0,10
PUSH "\e[?2K"
erase 0..1,0..80 selective
?cursor = 0,10
!ED 0
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "\e[2;2H"
?cursor = 1,1
PUSH "\e[0J"
erase 1..2,1..80
erase 2..25,0..80
?cursor = 1,1
!ED 1
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "\e[2;2H"
?cursor = 1,1
PUSH "\e[1J"
erase 0..1,0..80
erase 1..2,0..2
?cursor = 1,1
!ED 2
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "\e[2;2H"
?cursor = 1,1
PUSH "\e[2J"
erase 0..25,0..80
?cursor = 1,1
!ED 3
PUSH "\e[3J"
sb_clear
!SED
RESET
erase 0..25,0..80
PUSH "\e[5;5H"
?cursor = 4,4
PUSH "\e[?0J"
erase 4..5,4..80 selective
erase 5..25,0..80 selective
?cursor = 4,4
PUSH "\e[?1J"
erase 0..4,0..80 selective
erase 4..5,0..5 selective
?cursor = 4,4
PUSH "\e[?2J"
erase 0..25,0..80 selective
?cursor = 4,4
!DECRQSS on DECSCA
PUSH "\e[2\"q"
PUSH "\eP\$q\"q\e\\"
output "\eP1\$r2\"q\e\\"
WANTSTATE -s+m
!ICH move+erase emuation
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "ACD"
PUSH "\e[2D"
?cursor = 0,1
PUSH "\e[@"
moverect 0..1,1..79 -> 0..1,2..80
erase 0..1,1..2
?cursor = 0,1
PUSH "B"
?cursor = 0,2
PUSH "\e[3@"
moverect 0..1,2..77 -> 0..1,5..80
erase 0..1,2..5
!DCH move+erase emulation
RESET
erase 0..25,0..80
?cursor = 0,0
PUSH "ABBC"
PUSH "\e[3D"
?cursor = 0,1
PUSH "\e[P"
moverect 0..1,2..80 -> 0..1,1..79
erase 0..1,79..80
?cursor = 0,1
PUSH "\e[3P"
moverect 0..1,4..80 -> 0..1,1..77
erase 0..1,77..80
?cursor = 0,1
|