ctlseqs.txt revision f2e35a3a
1
2
3
4
5
6
7
8
9
10                        XTerm Control Sequences
11
12
13                               Edward Moy
14                   University of California, Berkeley
15
16                               Revised by
17
18                             Stephen Gildea
19                          X Consortium (1994)
20
21                             Thomas Dickey
22                      XFree86 Project (1996-2006)
23                    invisible-island.net (2006-2020)
24               updated for XTerm Patch #363 (2020/12/25)
25
26
27
28
29Definitions
30
31Many controls use parameters, shown in italics.  If a control uses a
32single parameter, only one parameter name is listed.  Some parameters
33(along with separating ;  characters) may be optional.  Other characters
34in the control are required.
35
36C    A single (required) character.
37
38Ps   A single (usually optional) numeric parameter, composed of one or
39     more digits.
40
41Pm   Any number of single numeric parameters, separated by ;
42     character(s).  Individual values for the parameters are listed with
43     Ps .
44
45Pt   A text parameter composed of printable characters.
46
47
48Control Bytes, Characters, and Sequences
49
50ECMA-48 (aka "ISO 6429") documents C1 (8-bit) and C0 (7-bit) codes.
51Those are respectively codes 128 to 159 and 0 to 31.  ECMA-48 avoids
52referring to these codes as characters, because that term is associated
53with graphic characters.  Instead, it uses "bytes" and "codes", with
54occasional lapses to "characters" where the meaning cannot be mistaken.
55
56Controls (including the escape code 27) are processed once:
57
58o   This means that a C1 control can be mistaken for badly-formed UTF-8
59    when the terminal runs in UTF-8 mode because C1 controls are valid
60    continuation bytes of a UTF-8 encoded (multibyte) value.
61
62o   It is not possible to use a C1 control obtained from decoding the
63    UTF-8 text, because that would require reprocessing the data.
64    Consequently there is no ambiguity in the way this document uses the
65    term "character" to refer to bytes in a control sequence.
66
67The order of processing is a necessary consequence of the way ECMA-48 is
68designed:
69
70o   Each byte sent to the terminal can be unambiguously determined to
71    fall into one of a few categories (C0, C1 and graphic characters).
72
73o   ECMA-48 is modal; once it starts processing a control sequence, the
74    terminal continues until the sequence is complete, or some byte is
75    found which is not allowed in the sequence.
76
77o   Intermediate, parameter and final bytes may use the same codes as
78    graphic characters, but they are processed as part of a control
79    sequence and are not actually graphic characters.
80
81o   Eight-bit controls can have intermediate, etc., bytes in the range
82    160 to 255.  Those can be treated as their counterparts in the range
83    32 to 127.
84
85o   Single-byte controls can be handled separately from multi-byte
86    control sequences because ECMA-48's rules are unambiguous.
87
88    As a special case, ECMA-48 (section 9) mentions that the control
89    functions shift-in and shift-out are allowed to occur within a 7-bit
90    multibyte control sequence because those cannot alter the meaning of
91    the control sequence.
92
93o   Some controls (such as OSC ) introduce a string mode, which is ended
94    on a ST  (string terminator).
95
96    ECMA-48 describes only correct behavior, telling what types of
97    characters are expected at each stage of the control sequences.  It
98    says that the action taken in error recovery is implementation-
99    dependent.  XTerm decodes control sequences using a state machine.
100    It handles errors in decoding i.e., unexpected characters, by
101    resetting to the initial (ground) state.  That is different from the
102    treatment of unimplemented (but correctly formatted) features.
103
104    If an application does not send the string terminator, that is also
105    an error from the standpoint of a user.  To accommodate users of
106    those applications, xterm has resource settings which allow
107    workarounds:
108
109    o   The Linux console's palette sequences do not use a string
110        terminator.  The brokenLinuxOSC resource setting tells xterm to
111        ignore those particular sequences.
112
113    o   The terminal should accept single-byte controls within the
114        string.  But some applications omit a string terminator, like
115        the Linux console.  The brokenStringTerm resource setting tells
116        xterm to exit string mode if it decodes a common control
117        character such as carriage return before the string terminator.
118
119
120C1 (8-Bit) Control Characters
121
122The xterm program recognizes both 8-bit and 7-bit control characters.
123It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled.
124The following pairs of 7-bit and 8-bit control characters are
125equivalent:
126
127ESC D
128     Index (IND  is 0x84).
129
130ESC E
131     Next Line (NEL  is 0x85).
132
133ESC H
134     Tab Set (HTS  is 0x88).
135
136ESC M
137     Reverse Index (RI  is 0x8d).
138
139ESC N
140     Single Shift Select of G2 Character Set (SS2  is 0x8e), VT220.
141     This affects next character only.
142
143ESC O
144     Single Shift Select of G3 Character Set (SS3  is 0x8f), VT220.
145     This affects next character only.
146
147ESC P
148     Device Control String (DCS  is 0x90).
149
150ESC V
151     Start of Guarded Area (SPA  is 0x96).
152
153ESC W
154     End of Guarded Area (EPA  is 0x97).
155
156ESC X
157     Start of String (SOS  is 0x98).
158
159ESC Z
160     Return Terminal ID (DECID is 0x9a).  Obsolete form of CSI c  (DA).
161
162ESC [
163     Control Sequence Introducer (CSI  is 0x9b).
164
165ESC \
166     String Terminator (ST  is 0x9c).
167
168ESC ]
169     Operating System Command (OSC  is 0x9d).
170
171ESC ^
172     Privacy Message (PM  is 0x9e).
173
174ESC _
175     Application Program Command (APC  is 0x9f).
176
177
178These control characters are used in the vtXXX emulation.
179
180
181VT100 Mode
182
183In this document, "VT100" refers not only to VT100/VT102, but also to
184the succession of upward-compatible terminals produced by DEC (Digital
185Equipment Corporation) from the mid-1970s for about twenty years.  For
186brevity, the document refers to the related models:
187  "VT200" as VT220/VT240,
188  "VT300" as VT320/VT340,
189  "VT400" as VT420, and
190  "VT500" as VT510/VT520/VT525.
191
192Most of these control sequences are standard VT102 control sequences,
193but there is support for later DEC VT terminals (i.e., VT220, VT320,
194VT420, VT510), as well as ECMA-48 and aixterm color controls.  The only
195VT102 feature not supported is auto-repeat, since the only way X
196provides for this will affect all windows.
197
198There are additional control sequences to provide xterm-dependent
199functions, such as the scrollbar or window size.  Where the function is
200specified by DEC or ECMA-48, the code assigned to it is given in
201parentheses.
202
203The escape codes to designate and invoke character sets are specified by
204ISO 2022 (see that document for a discussion of character sets).
205
206Many of the features are optional; xterm can be configured and built
207without support for them.
208
209
210Single-character functions
211
212BEL       Bell (BEL  is Ctrl-G).
213
214BS        Backspace (BS  is Ctrl-H).
215
216CR        Carriage Return (CR  is Ctrl-M).
217
218ENQ       Return Terminal Status (ENQ  is Ctrl-E).  Default response is
219          an empty string, but may be overridden by a resource
220          answerbackString.
221
222FF        Form Feed or New Page (NP ).  (FF  is Ctrl-L).  FF  is treated
223          the same as LF .
224
225LF        Line Feed or New Line (NL).  (LF  is Ctrl-J).
226
227SI        Switch to Standard Character Set (Ctrl-O is Shift In or LS0).
228          This invokes the G0 character set (the default) as GL.
229          VT200 and up implement LS0.
230
231SO        Switch to Alternate Character Set (Ctrl-N is Shift Out or
232          LS1).  This invokes the G1 character set as GL.
233          VT200 and up implement LS1.
234
235SP        Space.
236
237TAB       Horizontal Tab (HTS  is Ctrl-I).
238
239VT        Vertical Tab (VT  is Ctrl-K).  This is treated the same as LF.
240
241
242Controls beginning with ESC
243
244This excludes controls where ESC  is part of a 7-bit equivalent to 8-bit
245C1 controls, ordered by the final character(s).
246
247ESC SP F  7-bit controls (S7C1T), VT220.  This tells the terminal to
248          send C1 control characters as 7-bit sequences, e.g., its
249          responses to queries.  DEC VT200 and up always accept 8-bit
250          control sequences except when configured for VT100 mode.
251
252ESC SP G  8-bit controls (S8C1T), VT220.  This tells the terminal to
253          send C1 control characters as 8-bit sequences, e.g., its
254          responses to queries.  DEC VT200 and up always accept 8-bit
255          control sequences except when configured for VT100 mode.
256
257ESC SP L  Set ANSI conformance level 1, ECMA-43.
258
259ESC SP M  Set ANSI conformance level 2, ECMA-43.
260
261ESC SP N  Set ANSI conformance level 3, ECMA-43.
262
263ESC # 3   DEC double-height line, top half (DECDHL), VT100.
264
265ESC # 4   DEC double-height line, bottom half (DECDHL), VT100.
266
267ESC # 5   DEC single-width line (DECSWL), VT100.
268
269ESC # 6   DEC double-width line (DECDWL), VT100.
270
271ESC # 8   DEC Screen Alignment Test (DECALN), VT100.
272
273ESC % @   Select default character set.  That is ISO 8859-1 (ISO 2022).
274
275ESC % G   Select UTF-8 character set, ISO 2022.
276
277ESC ( C   Designate G0 Character Set, VT100, ISO 2022.
278          Final character C for designating 94-character sets.  In this
279          list,
280          o   0 , A  and B  were introduced in the VT100,
281          o   most were introduced in the VT200 series,
282          o   a few were introduced in the VT300 series, and
283          o   a few more were introduced in the VT500 series.
284          The VT220 character sets, together with a few others (such as
285          Portuguese) are activated by the National Replacement
286          Character Set (NRCS) controls.  The term "replacement" says
287          that the character set is formed by replacing some of the
288          characters in a set (termed the Multinational Character Set)
289          with more useful ones for a given language.  The ASCII and DEC
290          Supplemental character sets make up the two halves of the
291          Multinational Character set, initially mapped to GL and GR.
292          The valid final characters C for this control are:
293            C = A  -> United Kingdom (UK), VT100.
294            C = B  -> United States (USASCII), VT100.
295            C = C  or 5  -> Finnish, VT200.
296            C = H  or 7  -> Swedish, VT200.
297            C = K  -> German, VT200.
298            C = Q  or 9  -> French Canadian, VT200.
299            C = R  or f  -> French, VT200.
300            C = Y  -> Italian, VT200.
301            C = Z  -> Spanish, VT200.
302            C = 4  -> Dutch, VT200.
303            C = " >  -> Greek, VT500.
304            C = % 2  -> Turkish, VT500.
305            C = % 6  -> Portuguese, VT300.
306            C = % =  -> Hebrew, VT500.
307            C = =  -> Swiss, VT200.
308            C = ` , E  or 6  -> Norwegian/Danish, VT200.
309          The final character A  is a special case, since the same final
310          character is used by the VT300-control for the 96-character
311          British Latin-1.
312          There are a few other 94-character sets:
313            C = 0  -> DEC Special Character and Line Drawing Set, VT100.
314            C = <  -> DEC Supplemental, VT200.
315            C = >  -> DEC Technical, VT300.
316          These are documented as 94-character sets (like USASCII)
317          without NRCS:
318            C = " 4  -> DEC Hebrew, VT500.
319            C = " ?  -> DEC Greek, VT500.
320            C = % 0  -> DEC Turkish, VT500.
321            C = % 5  -> DEC Supplemental Graphics, VT300.
322            C = & 4  -> DEC Cyrillic, VT500.
323          The VT520 reference manual lists a few more, but no
324          documentation has been found for the mappings:
325            C = % 3  -> SCS NRCS, VT500.
326            C = & 5  -> DEC Russian, VT500.
327
328ESC ) C   Designate G1 Character Set, ISO 2022, VT100.
329          The same character sets apply as for ESC ( C.
330
331ESC * C   Designate G2 Character Set, ISO 2022, VT220.
332          The same character sets apply as for ESC ( C.
333
334ESC + C   Designate G3 Character Set, ISO 2022, VT220.
335          The same character sets apply as for ESC ( C.
336
337ESC - C   Designate G1 Character Set, VT300.
338          These controls apply only to 96-character sets.  Unlike the
339          94-character sets, these can have different values than ASCII
340          space and DEL for the mapping of 0x20 and 0x7f.  The valid
341          final characters C for this control are:
342            C = A  -> ISO Latin-1 Supplemental, VT300.
343            C = B  -> ISO Latin-2 Supplemental, VT500.
344            C = F  -> ISO Greek Supplemental, VT500.
345            C = H  -> ISO Hebrew Supplemental, VT500.
346            C = L  -> ISO Latin-Cyrillic, VT500.
347            C = M  -> ISO Latin-5 Supplemental, VT500.
348
349ESC . C   Designate G2 Character Set, VT300.
350          The same character sets apply as for ESC - C.
351
352ESC / C   Designate G3 Character Set, VT300.
353          The same character sets apply as for ESC - C.
354
355ESC 6     Back Index (DECBI), VT420 and up.
356
357ESC 7     Save Cursor (DECSC), VT100.
358
359ESC 8     Restore Cursor (DECRC), VT100.
360
361ESC 9     Forward Index (DECFI), VT420 and up.
362
363ESC =     Application Keypad (DECKPAM).
364
365ESC >     Normal Keypad (DECKPNM), VT100.
366
367ESC F     Cursor to lower left corner of screen.  This is enabled by the
368          hpLowerleftBugCompat resource.
369
370ESC c     Full Reset (RIS), VT100.
371
372ESC l     Memory Lock (per HP terminals).  Locks memory above the
373          cursor.
374
375ESC m     Memory Unlock (per HP terminals).
376
377ESC n     Invoke the G2 Character Set as GL (LS2).
378
379ESC o     Invoke the G3 Character Set as GL (LS3).
380
381ESC |     Invoke the G3 Character Set as GR (LS3R).
382
383ESC }     Invoke the G2 Character Set as GR (LS2R).
384
385ESC ~     Invoke the G1 Character Set as GR (LS1R), VT100.
386
387
388Application Program-Command functions
389
390APC Pt ST None.  xterm implements no APC  functions; Pt is ignored.  Pt
391          need not be printable characters.
392
393
394Device-Control functions
395
396DCS Ps ; Ps | Pt ST
397          User-Defined Keys (DECUDK), VT220 and up.
398
399          The first parameter:
400            Ps = 0  -> Clear all UDK definitions before starting
401          (default).
402            Ps = 1  -> Erase Below (default).
403
404          The second parameter:
405            Ps = 0  <- Lock the keys (default).
406            Ps = 1  <- Do not lock.
407
408          The third parameter is a ";"-separated list of strings
409          denoting the key-code separated by a "/" from the hex-encoded
410          key value.  The key codes correspond to the DEC function-key
411          codes (e.g., F6=17).
412
413DCS $ q Pt ST
414          Request Status String (DECRQSS), VT420 and up.
415          The string following the "q" is one of the following:
416            m       -> SGR
417            " p     -> DECSCL
418            SP q    -> DECSCUSR
419            " q     -> DECSCA
420            r       -> DECSTBM
421            s       -> DECSLRM
422            t       -> DECSLPP
423            $ |     -> DECSCPP
424            * |     -> DECSNLS
425          xterm responds with DCS 1 $ r Pt ST for valid requests,
426          replacing the Pt with the corresponding CSI string, or DCS 0 $
427          r Pt ST for invalid requests.
428
429DCS Ps $ t Pt ST
430          Restore presentation status (DECRSPS), VT320 and up.  The
431          control can be converted from a response from DECCIR or
432          DECTABSR by changing the first "u" to a "t"
433            Ps = 1  -> DECCIR
434            Ps = 2  -> DECTABSR
435
436DCS + Q Pt ST
437          Request resource values (XTGETXRES), xterm.  The string
438          following the "Q" is a list of names encoded in hexadecimal (2
439          digits per character) separated by ; which correspond to xterm
440          resource names.  Only boolean, numeric and string resources
441          are supported by this query.
442
443          xterm responds with
444          DCS 1 + R Pt ST for valid requests, adding to Pt an = , and
445          the value of the corresponding resource that xterm is using,
446          or
447          DCS 0 + R Pt ST for invalid requests.
448          The strings are encoded in hexadecimal (2 digits per
449          character).
450
451
452DCS + p Pt ST
453          Set Termcap/Terminfo Data (XTSETTCAP), xterm.  The string
454          following the "p" is a name to use for retrieving data from
455          the terminal database.  The data will be used for the "tcap"
456          keyboard configuration's function- and special-keys, as well
457          as by the Request Termcap/Terminfo String control.
458
459
460DCS + q Pt ST
461          Request Termcap/Terminfo String (XTGETTCAP), xterm.  The
462          string following the "q" is a list of names encoded in
463          hexadecimal (2 digits per character) separated by ; which
464          correspond to termcap or terminfo key names.
465          A few special features are also recognized, which are not key
466          names:
467
468          o   Co for termcap colors (or colors for terminfo colors), and
469
470          o   TN for termcap name (or name for terminfo name).
471
472          o   RGB for the ncurses direct-color extension.
473              Only a terminfo name is provided, since termcap
474              applications cannot use this information.
475
476          xterm responds with
477          DCS 1 + r Pt ST for valid requests, adding to Pt an = , and
478          the value of the corresponding string that xterm would send,
479          or
480          DCS 0 + r Pt ST for invalid requests.
481          The strings are encoded in hexadecimal (2 digits per
482          character).
483
484
485Functions using CSI , ordered by the final character(s)
486
487CSI Ps @  Insert Ps (Blank) Character(s) (default = 1) (ICH).
488
489CSI Ps SP @
490          Shift left Ps columns(s) (default = 1) (SL), ECMA-48.
491
492CSI Ps A  Cursor Up Ps Times (default = 1) (CUU).
493
494CSI Ps SP A
495          Shift right Ps columns(s) (default = 1) (SR), ECMA-48.
496
497CSI Ps B  Cursor Down Ps Times (default = 1) (CUD).
498
499CSI Ps C  Cursor Forward Ps Times (default = 1) (CUF).
500
501CSI Ps D  Cursor Backward Ps Times (default = 1) (CUB).
502
503CSI Ps E  Cursor Next Line Ps Times (default = 1) (CNL).
504
505CSI Ps F  Cursor Preceding Line Ps Times (default = 1) (CPL).
506
507CSI Ps G  Cursor Character Absolute  [column] (default = [row,1]) (CHA).
508
509CSI Ps ; Ps H
510          Cursor Position [row;column] (default = [1,1]) (CUP).
511
512CSI Ps I  Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
513
514CSI Ps J  Erase in Display (ED), VT100.
515            Ps = 0  -> Erase Below (default).
516            Ps = 1  -> Erase Above.
517            Ps = 2  -> Erase All.
518            Ps = 3  -> Erase Saved Lines, xterm.
519
520CSI ? Ps J
521          Erase in Display (DECSED), VT220.
522            Ps = 0  -> Selective Erase Below (default).
523            Ps = 1  -> Selective Erase Above.
524            Ps = 2  -> Selective Erase All.
525            Ps = 3  -> Selective Erase Saved Lines, xterm.
526
527CSI Ps K  Erase in Line (EL), VT100.
528            Ps = 0  -> Erase to Right (default).
529            Ps = 1  -> Erase to Left.
530            Ps = 2  -> Erase All.
531
532CSI ? Ps K
533          Erase in Line (DECSEL), VT220.
534            Ps = 0  -> Selective Erase to Right (default).
535            Ps = 1  -> Selective Erase to Left.
536            Ps = 2  -> Selective Erase All.
537
538CSI Ps L  Insert Ps Line(s) (default = 1) (IL).
539
540CSI Ps M  Delete Ps Line(s) (default = 1) (DL).
541
542CSI Ps P  Delete Ps Character(s) (default = 1) (DCH).
543
544CSI # P
545CSI Pm # P
546          Push current dynamic- and ANSI-palette colors onto stack
547          (XTPUSHCOLORS), xterm.  Parameters (integers in the range 1
548          through 10, since the default 0 will push) may be used to
549          store the palette into the stack without pushing.
550
551CSI # Q
552CSI Pm # Q
553          Pop stack to set dynamic- and ANSI-palette colors
554          (XTPOPCOLORS), xterm.  Parameters (integers in the range 1
555          through 10, since the default 0 will pop) may be used to
556          restore the palette from the stack without popping.
557
558CSI # R   Report the current entry on the palette stack, and the number
559          of palettes stored on the stack, using the same form as
560          XTPOPCOLOR (default = 0) (XTREPORTCOLORS), xterm.
561
562CSI Ps S  Scroll up Ps lines (default = 1) (SU), VT420, ECMA-48.
563
564CSI ? Pi ; Pa ; Pv S
565          Set or request graphics attribute (XTSMGRAPHICS), xterm.  If
566          configured to support either Sixel Graphics or ReGIS Graphics,
567          xterm accepts a three-parameter control sequence, where Pi, Pa
568          and Pv are the item, action and value:
569
570            Pi = 1  -> item is number of color registers.
571            Pi = 2  -> item is Sixel graphics geometry (in pixels).
572            Pi = 3  -> item is ReGIS graphics geometry (in pixels).
573
574            Pa = 1  -> read attribute.
575            Pa = 2  -> reset to default.
576            Pa = 3  -> set to value in Pv.
577            Pa = 4  -> read the maximum allowed value.
578
579            Pv is ignored by xterm except when setting (Pa == 3 ).
580            Pv = n <- A single integer is used for color registers.
581            Pv = width ; height <- Two integers for graphics geometry.
582
583          xterm replies with a control sequence of the same form:
584
585               CSI ? Pi ; Ps ; Pv S
586
587          where Ps is the status:
588            Ps = 0  <- success.
589            Ps = 1  <- error in Pi.
590            Ps = 2  <- error in Pa.
591            Ps = 3  <- failure.
592
593          On success, Pv represents the value read or set.
594
595          Notes:
596          o   The current implementation allows reading the graphics
597              sizes, but disallows modifying those sizes because that is
598              done once, using resource-values.
599          o   Graphics geometry is not necessarily the same as "window
600              size" (see the dtterm window manipulation extensions).
601              For example, xterm limits the maximum graphics geometry at
602              compile time (1000x1000 as of version 328) although the
603              window size can be larger.
604          o   While resizing a window will always change the current
605              graphics geometry, the reverse is not true.  Setting
606              graphics geometry does not affect the window size.
607
608CSI Ps T  Scroll down Ps lines (default = 1) (SD), VT420.
609
610CSI Ps ; Ps ; Ps ; Ps ; Ps T
611          Initiate highlight mouse tracking (XTHIMOUSE), xterm.
612          Parameters are [func;startx;starty;firstrow;lastrow].  See the
613          section Mouse Tracking.
614
615CSI > Pm T
616          Reset title mode features to default value (XTRMTITLE), xterm.
617          Normally, "reset" disables the feature.  It is possible to
618          disable the ability to reset features by compiling a different
619          default for the title modes into xterm.
620
621            Ps = 0  -> Do not set window/icon labels using hexadecimal.
622            Ps = 1  -> Do not query window/icon labels using
623          hexadecimal.
624            Ps = 2  -> Do not set window/icon labels using UTF-8.
625            Ps = 3  -> Do not query window/icon labels using UTF-8.
626
627          (See discussion of Title Modes).
628
629CSI Ps X  Erase Ps Character(s) (default = 1) (ECH).
630
631CSI Ps Z  Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
632
633CSI Ps ^  Scroll down Ps lines (default = 1) (SD), ECMA-48.
634          This was a publication error in the original ECMA-48 5th
635          edition (1991) corrected in 2003.
636
637CSI Ps `  Character Position Absolute  [column] (default = [row,1])
638          (HPA).
639
640CSI Ps a  Character Position Relative  [columns] (default = [row,col+1])
641          (HPR).
642
643CSI Ps b  Repeat the preceding graphic character Ps times (REP).
644
645CSI Ps c  Send Device Attributes (Primary DA).
646            Ps = 0  or omitted -> request attributes from terminal.  The
647          response depends on the decTerminalID resource setting.
648            -> CSI ? 1 ; 2 c  ("VT100 with Advanced Video Option")
649            -> CSI ? 1 ; 0 c  ("VT101 with No Options")
650            -> CSI ? 4 ; 6 c  ("VT132 with Advanced Video and Graphics")
651            -> CSI ? 6 c  ("VT102")
652            -> CSI ? 7 c  ("VT131")
653            -> CSI ? 1 2 ; Ps c  ("VT125")
654            -> CSI ? 6 2 ; Ps c  ("VT220")
655            -> CSI ? 6 3 ; Ps c  ("VT320")
656            -> CSI ? 6 4 ; Ps c  ("VT420")
657
658          The VT100-style response parameters do not mean anything by
659          themselves.  VT220 (and higher) parameters do, telling the
660          host what features the terminal supports:
661            Ps = 1  -> 132-columns.
662            Ps = 2  -> Printer.
663            Ps = 3  -> ReGIS graphics.
664            Ps = 4  -> Sixel graphics.
665            Ps = 6  -> Selective erase.
666            Ps = 8  -> User-defined keys.
667            Ps = 9  -> National Replacement Character sets.
668            Ps = 1 5  -> Technical characters.
669            Ps = 1 6  -> Locator port.
670            Ps = 1 7  -> Terminal state interrogation.
671            Ps = 1 8  -> User windows.
672            Ps = 2 1  -> Horizontal scrolling.
673            Ps = 2 2  -> ANSI color, e.g., VT525.
674            Ps = 2 8  -> Rectangular editing.
675            Ps = 2 9  -> ANSI text locator (i.e., DEC Locator mode).
676
677          XTerm supports part of the User windows feature, providing a
678          single page (which corresponds to its visible window).  Rather
679          than resizing the font to change the number of lines/columns
680          in a fixed-size display, xterm uses the window extension
681          controls (DECSNLS, DECSCPP, DECSLPP) to adjust its visible
682          window's size.  The "cursor coupling" controls (DECHCCM,
683          DECPCCM, DECVCCM) are ignored.
684
685CSI = Ps c
686          Send Device Attributes (Tertiary DA).
687            Ps = 0  -> report Terminal Unit ID (default), VT400.  XTerm
688          uses zeros for the site code and serial number in its DECRPTUI
689          response.
690
691CSI > Ps c
692          Send Device Attributes (Secondary DA).
693            Ps = 0  or omitted -> request the terminal's identification
694          code.  The response depends on the decTerminalID resource
695          setting.  It should apply only to VT220 and up, but xterm
696          extends this to VT100.
697            -> CSI  > Pp ; Pv ; Pc c
698          where Pp denotes the terminal type
699            Pp = 0  -> "VT100".
700            Pp = 1  -> "VT220".
701            Pp = 2  -> "VT240" or "VT241".
702            Pp = 1 8  -> "VT330".
703            Pp = 1 9  -> "VT340".
704            Pp = 2 4  -> "VT320".
705            Pp = 3 2  -> "VT382".
706            Pp = 4 1  -> "VT420".
707            Pp = 6 1  -> "VT510".
708            Pp = 6 4  -> "VT520".
709            Pp = 6 5  -> "VT525".
710
711          and Pv is the firmware version (for xterm, this was originally
712          the XFree86 patch number, starting with 95).  In a DEC
713          terminal, Pc indicates the ROM cartridge registration number
714          and is always zero.
715
716CSI Ps d  Line Position Absolute  [row] (default = [1,column]) (VPA).
717
718CSI Ps e  Line Position Relative  [rows] (default = [row+1,column])
719          (VPR).
720
721CSI Ps ; Ps f
722          Horizontal and Vertical Position [row;column] (default =
723          [1,1]) (HVP).
724
725CSI Ps g  Tab Clear (TBC).
726            Ps = 0  -> Clear Current Column (default).
727            Ps = 3  -> Clear All.
728
729CSI Pm h  Set Mode (SM).
730            Ps = 2  -> Keyboard Action Mode (KAM).
731            Ps = 4  -> Insert Mode (IRM).
732            Ps = 1 2  -> Send/receive (SRM).
733            Ps = 2 0  -> Automatic Newline (LNM).
734
735CSI ? Pm h
736          DEC Private Mode Set (DECSET).
737            Ps = 1  -> Application Cursor Keys (DECCKM), VT100.
738            Ps = 2  -> Designate USASCII for character sets G0-G3
739          (DECANM), VT100, and set VT100 mode.
740            Ps = 3  -> 132 Column Mode (DECCOLM), VT100.
741            Ps = 4  -> Smooth (Slow) Scroll (DECSCLM), VT100.
742            Ps = 5  -> Reverse Video (DECSCNM), VT100.
743            Ps = 6  -> Origin Mode (DECOM), VT100.
744            Ps = 7  -> Auto-Wrap Mode (DECAWM), VT100.
745            Ps = 8  -> Auto-Repeat Keys (DECARM), VT100.
746            Ps = 9  -> Send Mouse X & Y on button press.  See the
747          section Mouse Tracking.  This is the X10 xterm mouse protocol.
748            Ps = 1 0  -> Show toolbar (rxvt).
749            Ps = 1 2  -> Start blinking cursor (AT&T 610).
750            Ps = 1 3  -> Start blinking cursor (set only via resource or
751          menu).
752            Ps = 1 4  -> Enable XOR of blinking cursor control sequence
753          and menu.
754            Ps = 1 8  -> Print Form Feed (DECPFF), VT220.
755            Ps = 1 9  -> Set print extent to full screen (DECPEX),
756          VT220.
757            Ps = 2 5  -> Show cursor (DECTCEM), VT220.
758            Ps = 3 0  -> Show scrollbar (rxvt).
759            Ps = 3 5  -> Enable font-shifting functions (rxvt).
760            Ps = 3 8  -> Enter Tektronix mode (DECTEK), VT240, xterm.
761            Ps = 4 0  -> Allow 80 -> 132 mode, xterm.
762            Ps = 4 1  -> more(1) fix (see curses resource).
763            Ps = 4 2  -> Enable National Replacement Character sets
764          (DECNRCM), VT220.
765            Ps = 4 3  -> Enable Graphics Expanded Print Mode (DECGEPM).
766            Ps = 4 4  -> Turn on margin bell, xterm.
767            Ps = 4 4  -> Enable Graphics Print Color Mode (DECGPCM).
768            Ps = 4 5  -> Reverse-wraparound mode, xterm.
769            Ps = 4 5  -> Enable Graphics Print ColorSpace (DECGPCS).
770            Ps = 4 6  -> Start logging, xterm.  This is normally
771          disabled by a compile-time option.
772            Ps = 4 7  -> Use Alternate Screen Buffer, xterm.  This may
773          be disabled by the titeInhibit resource.
774            Ps = 4 7  -> Enable Graphics Rotated Print Mode (DECGRPM).
775            Ps = 6 6  -> Application keypad mode (DECNKM), VT320.
776            Ps = 6 7  -> Backarrow key sends backspace (DECBKM), VT340,
777          VT420.  This sets the backarrowKey resource to "true".
778            Ps = 6 9  -> Enable left and right margin mode (DECLRMM),
779          VT420 and up.
780            Ps = 8 0  -> Enable Sixel Scrolling (DECSDM).
781            Ps = 9 5  -> Do not clear screen when DECCOLM is set/reset
782          (DECNCSM), VT510 and up.
783            Ps = 1 0 0 0  -> Send Mouse X & Y on button press and
784          release.  See the section Mouse Tracking.  This is the X11
785          xterm mouse protocol.
786            Ps = 1 0 0 1  -> Use Hilite Mouse Tracking, xterm.
787            Ps = 1 0 0 2  -> Use Cell Motion Mouse Tracking, xterm.  See
788          the section Button-event tracking.
789            Ps = 1 0 0 3  -> Use All Motion Mouse Tracking, xterm.  See
790          the section Any-event tracking.
791            Ps = 1 0 0 4  -> Send FocusIn/FocusOut events, xterm.
792            Ps = 1 0 0 5  -> Enable UTF-8 Mouse Mode, xterm.
793            Ps = 1 0 0 6  -> Enable SGR Mouse Mode, xterm.
794            Ps = 1 0 0 7  -> Enable Alternate Scroll Mode, xterm.  This
795          corresponds to the alternateScroll resource.
796            Ps = 1 0 1 0  -> Scroll to bottom on tty output (rxvt).
797          This sets the scrollTtyOutput resource to "true".
798            Ps = 1 0 1 1  -> Scroll to bottom on key press (rxvt).  This
799          sets the scrollKey resource to "true".
800            Ps = 1 0 1 5  -> Enable urxvt Mouse Mode.
801            Ps = 1 0 1 6  -> Enable SGR Mouse PixelMode, xterm.
802            Ps = 1 0 3 4  -> Interpret "meta" key, xterm.  This sets the
803          eighth bit of keyboard input (and enables the eightBitInput
804          resource).
805            Ps = 1 0 3 5  -> Enable special modifiers for Alt and
806          NumLock keys, xterm.  This enables the numLock resource.
807            Ps = 1 0 3 6  -> Send ESC   when Meta modifies a key, xterm.
808          This enables the metaSendsEscape resource.
809            Ps = 1 0 3 7  -> Send DEL from the editing-keypad Delete
810          key, xterm.
811            Ps = 1 0 3 9  -> Send ESC  when Alt modifies a key, xterm.
812          This enables the altSendsEscape resource, xterm.
813            Ps = 1 0 4 0  -> Keep selection even if not highlighted,
814          xterm.  This enables the keepSelection resource.
815            Ps = 1 0 4 1  -> Use the CLIPBOARD selection, xterm.  This
816          enables the selectToClipboard resource.
817            Ps = 1 0 4 2  -> Enable Urgency window manager hint when
818          Control-G is received, xterm.  This enables the bellIsUrgent
819          resource.
820            Ps = 1 0 4 3  -> Enable raising of the window when Control-G
821          is received, xterm.  This enables the popOnBell resource.
822            Ps = 1 0 4 4  -> Reuse the most recent data copied to
823          CLIPBOARD, xterm.  This enables the keepClipboard resource.
824            Ps = 1 0 4 6  -> Enable switching to/from Alternate Screen
825          Buffer, xterm.  This works for terminfo-based systems,
826          updating the titeInhibit resource.
827            Ps = 1 0 4 7  -> Use Alternate Screen Buffer, xterm.  This
828          may be disabled by the titeInhibit resource.
829            Ps = 1 0 4 8  -> Save cursor as in DECSC, xterm.  This may
830          be disabled by the titeInhibit resource.
831            Ps = 1 0 4 9  -> Save cursor as in DECSC, xterm.  After
832          saving the cursor, switch to the Alternate Screen Buffer,
833          clearing it first.  This may be disabled by the titeInhibit
834          resource.  This control combines the effects of the 1 0 4 7
835          and 1 0 4 8  modes.  Use this with terminfo-based applications
836          rather than the 4 7  mode.
837            Ps = 1 0 5 0  -> Set terminfo/termcap function-key mode,
838          xterm.
839            Ps = 1 0 5 1  -> Set Sun function-key mode, xterm.
840            Ps = 1 0 5 2  -> Set HP function-key mode, xterm.
841            Ps = 1 0 5 3  -> Set SCO function-key mode, xterm.
842            Ps = 1 0 6 0  -> Set legacy keyboard emulation, i.e, X11R6,
843          xterm.
844            Ps = 1 0 6 1  -> Set VT220 keyboard emulation, xterm.
845            Ps = 2 0 0 4  -> Set bracketed paste mode, xterm.
846
847CSI Ps i  Media Copy (MC).
848            Ps = 0  -> Print screen (default).
849            Ps = 4  -> Turn off printer controller mode.
850            Ps = 5  -> Turn on printer controller mode.
851            Ps = 1 0  -> HTML screen dump, xterm.
852            Ps = 1 1  -> SVG screen dump, xterm.
853
854CSI ? Ps i
855          Media Copy (MC), DEC-specific.
856            Ps = 1  -> Print line containing cursor.
857            Ps = 4  -> Turn off autoprint mode.
858            Ps = 5  -> Turn on autoprint mode.
859            Ps = 1 0  -> Print composed display, ignores DECPEX.
860            Ps = 1 1  -> Print all pages.
861
862CSI Pm l  Reset Mode (RM).
863            Ps = 2  -> Keyboard Action Mode (KAM).
864            Ps = 4  -> Replace Mode (IRM).
865            Ps = 1 2  -> Send/receive (SRM).
866            Ps = 2 0  -> Normal Linefeed (LNM).
867
868CSI ? Pm l
869          DEC Private Mode Reset (DECRST).
870            Ps = 1  -> Normal Cursor Keys (DECCKM), VT100.
871            Ps = 2  -> Designate VT52 mode (DECANM), VT100.
872            Ps = 3  -> 80 Column Mode (DECCOLM), VT100.
873            Ps = 4  -> Jump (Fast) Scroll (DECSCLM), VT100.
874            Ps = 5  -> Normal Video (DECSCNM), VT100.
875            Ps = 6  -> Normal Cursor Mode (DECOM), VT100.
876            Ps = 7  -> No Auto-Wrap Mode (DECAWM), VT100.
877            Ps = 8  -> No Auto-Repeat Keys (DECARM), VT100.
878            Ps = 9  -> Don't send Mouse X & Y on button press, xterm.
879            Ps = 1 0  -> Hide toolbar (rxvt).
880            Ps = 1 2  -> Stop blinking cursor (AT&T 610).
881            Ps = 1 3  -> Disable blinking cursor (reset only via
882          resource or menu).
883            Ps = 1 4  -> Disable XOR of blinking cursor control sequence
884          and menu.
885            Ps = 1 8  -> Don't Print Form Feed (DECPFF), VT220.
886            Ps = 1 9  -> Limit print to scrolling region (DECPEX),
887          VT220.
888            Ps = 2 5  -> Hide cursor (DECTCEM), VT220.
889            Ps = 3 0  -> Don't show scrollbar (rxvt).
890            Ps = 3 5  -> Disable font-shifting functions (rxvt).
891            Ps = 4 0  -> Disallow 80 -> 132 mode, xterm.
892            Ps = 4 1  -> No more(1) fix (see curses resource).
893            Ps = 4 2  -> Disable National Replacement Character sets
894          (DECNRCM), VT220.
895            Ps = 4 3  -> Disable Graphics Expanded Print Mode (DECGEPM).
896            Ps = 4 4  -> Turn off margin bell, xterm.
897            Ps = 4 4  -> Disable Graphics Print Color Mode (DECGPCM).
898            Ps = 4 5  -> No Reverse-wraparound mode, xterm.
899            Ps = 4 5  -> Disable Graphics Print ColorSpace (DECGPCS).
900            Ps = 4 6  -> Stop logging, xterm.  This is normally disabled
901          by a compile-time option.
902            Ps = 4 7  -> Use Normal Screen Buffer, xterm.
903            Ps = 4 7  -> Disable Graphics Rotated Print Mode (DECGRPM).
904            Ps = 6 6  -> Numeric keypad mode (DECNKM), VT320.
905            Ps = 6 7  -> Backarrow key sends delete (DECBKM), VT340,
906          VT420.  This sets the backarrowKey resource to "false".
907            Ps = 6 9  -> Disable left and right margin mode (DECLRMM),
908          VT420 and up.
909            Ps = 8 0  -> Disable Sixel Scrolling (DECSDM).
910            Ps = 9 5  -> Clear screen when DECCOLM is set/reset
911          (DECNCSM), VT510 and up.
912            Ps = 1 0 0 0  -> Don't send Mouse X & Y on button press and
913          release.  See the section Mouse Tracking.
914            Ps = 1 0 0 1  -> Don't use Hilite Mouse Tracking, xterm.
915            Ps = 1 0 0 2  -> Don't use Cell Motion Mouse Tracking,
916          xterm.  See the section Button-event tracking.
917            Ps = 1 0 0 3  -> Don't use All Motion Mouse Tracking, xterm.
918          See the section Any-event tracking.
919            Ps = 1 0 0 4  -> Don't send FocusIn/FocusOut events, xterm.
920            Ps = 1 0 0 5  -> Disable UTF-8 Mouse Mode, xterm.
921            Ps = 1 0 0 6  -> Disable SGR Mouse Mode, xterm.
922            Ps = 1 0 0 7  -> Disable Alternate Scroll Mode, xterm.  This
923          corresponds to the alternateScroll resource.
924            Ps = 1 0 1 0  -> Don't scroll to bottom on tty output
925          (rxvt).  This sets the scrollTtyOutput resource to "false".
926            Ps = 1 0 1 1  -> Don't scroll to bottom on key press (rxvt).
927          This sets the scrollKey resource to "false".
928            Ps = 1 0 1 5  -> Disable urxvt Mouse Mode.
929            Ps = 1 0 1 6  -> Disable SGR Mouse Pixel-Mode, xterm.
930            Ps = 1 0 3 4  -> Don't interpret "meta" key, xterm.  This
931          disables the eightBitInput resource.
932            Ps = 1 0 3 5  -> Disable special modifiers for Alt and
933          NumLock keys, xterm.  This disables the numLock resource.
934            Ps = 1 0 3 6  -> Don't send ESC  when Meta modifies a key,
935          xterm.  This disables the metaSendsEscape resource.
936            Ps = 1 0 3 7  -> Send VT220 Remove from the editing-keypad
937          Delete key, xterm.
938            Ps = 1 0 3 9  -> Don't send ESC when Alt modifies a key,
939          xterm.  This disables the altSendsEscape resource.
940            Ps = 1 0 4 0  -> Do not keep selection when not highlighted,
941          xterm.  This disables the keepSelection resource.
942            Ps = 1 0 4 1  -> Use the PRIMARY selection, xterm.  This
943          disables the selectToClipboard resource.
944            Ps = 1 0 4 2  -> Disable Urgency window manager hint when
945          Control-G is received, xterm.  This disables the bellIsUrgent
946          resource.
947            Ps = 1 0 4 3  -> Disable raising of the window when Control-
948          G is received, xterm.  This disables the popOnBell resource.
949            Ps = 1 0 4 6  -> Disable switching to/from Alternate Screen
950          Buffer, xterm.  This works for terminfo-based systems,
951          updating the titeInhibit resource.  If currently using the
952          Alternate Screen Buffer, xterm switches to the Normal Screen
953          Buffer.
954            Ps = 1 0 4 7  -> Use Normal Screen Buffer, xterm.  Clear the
955          screen first if in the Alternate Screen Buffer.  This may be
956          disabled by the titeInhibit resource.
957            Ps = 1 0 4 8  -> Restore cursor as in DECRC, xterm.  This
958          may be disabled by the titeInhibit resource.
959            Ps = 1 0 4 9  -> Use Normal Screen Buffer and restore cursor
960          as in DECRC, xterm.  This may be disabled by the titeInhibit
961          resource.  This combines the effects of the 1 0 4 7  and 1 0 4
962          8  modes.  Use this with terminfo-based applications rather
963          than the 4 7  mode.
964            Ps = 1 0 5 0  -> Reset terminfo/termcap function-key mode,
965          xterm.
966            Ps = 1 0 5 1  -> Reset Sun function-key mode, xterm.
967            Ps = 1 0 5 2  -> Reset HP function-key mode, xterm.
968            Ps = 1 0 5 3  -> Reset SCO function-key mode, xterm.
969            Ps = 1 0 6 0  -> Reset legacy keyboard emulation, i.e,
970          X11R6, xterm.
971            Ps = 1 0 6 1  -> Reset keyboard emulation to Sun/PC style,
972          xterm.
973            Ps = 2 0 0 4  -> Reset bracketed paste mode, xterm.
974
975CSI Pm m  Character Attributes (SGR).
976            Ps = 0  -> Normal (default), VT100.
977            Ps = 1  -> Bold, VT100.
978            Ps = 2  -> Faint, decreased intensity, ECMA-48 2nd.
979            Ps = 3  -> Italicized, ECMA-48 2nd.
980            Ps = 4  -> Underlined, VT100.
981            Ps = 5  -> Blink, VT100.
982          This appears as Bold in X11R6 xterm.
983            Ps = 7  -> Inverse, VT100.
984            Ps = 8  -> Invisible, i.e., hidden, ECMA-48 2nd, VT300.
985            Ps = 9  -> Crossed-out characters, ECMA-48 3rd.
986            Ps = 2 1  -> Doubly-underlined, ECMA-48 3rd.
987            Ps = 2 2  -> Normal (neither bold nor faint), ECMA-48 3rd.
988            Ps = 2 3  -> Not italicized, ECMA-48 3rd.
989            Ps = 2 4  -> Not underlined, ECMA-48 3rd.
990            Ps = 2 5  -> Steady (not blinking), ECMA-48 3rd.
991            Ps = 2 7  -> Positive (not inverse), ECMA-48 3rd.
992            Ps = 2 8  -> Visible, i.e., not hidden, ECMA-48 3rd, VT300.
993            Ps = 2 9  -> Not crossed-out, ECMA-48 3rd.
994            Ps = 3 0  -> Set foreground color to Black.
995            Ps = 3 1  -> Set foreground color to Red.
996            Ps = 3 2  -> Set foreground color to Green.
997            Ps = 3 3  -> Set foreground color to Yellow.
998            Ps = 3 4  -> Set foreground color to Blue.
999            Ps = 3 5  -> Set foreground color to Magenta.
1000            Ps = 3 6  -> Set foreground color to Cyan.
1001            Ps = 3 7  -> Set foreground color to White.
1002            Ps = 3 9  -> Set foreground color to default, ECMA-48 3rd.
1003            Ps = 4 0  -> Set background color to Black.
1004            Ps = 4 1  -> Set background color to Red.
1005            Ps = 4 2  -> Set background color to Green.
1006            Ps = 4 3  -> Set background color to Yellow.
1007            Ps = 4 4  -> Set background color to Blue.
1008            Ps = 4 5  -> Set background color to Magenta.
1009            Ps = 4 6  -> Set background color to Cyan.
1010            Ps = 4 7  -> Set background color to White.
1011            Ps = 4 9  -> Set background color to default, ECMA-48 3rd.
1012
1013          Some of the above note the edition of ECMA-48 which first
1014          describes a feature.  In its successive editions from 1979 to
1015          1991 (2nd 1979, 3rd 1984, 4th 1986, and 5th 1991), ECMA-48
1016          listed codes through 6 5 (skipping several toward the end of
1017          the range).  Most of the ECMA-48 codes not implemented in
1018          xterm were never implemented in a hardware terminal.  Several
1019          (such as 3 9  and 4 9 ) are either noted in ECMA-48 as
1020          implementation defined, or described in vague terms.
1021
1022          The successive editions of ECMA-48 give little attention to
1023          changes from one edition to the next, except to comment on
1024          features which have become obsolete.  ECMA-48 1st (1976) is
1025          unavailable; there is no reliable source of information which
1026          states whether "ANSI" color was defined in that edition, or
1027          later (1979).  The VT100 (1978) implemented the most commonly
1028          used non-color video attributes which are given in the 2nd
1029          edition.
1030
1031          While 8-color support is described in ECMA-48 2nd edition, the
1032          VT500 series (introduced in 1993) were the first DEC terminals
1033          implementing "ANSI" color.  The DEC terminal's use of color is
1034          known to differ from xterm; useful documentation on this
1035          series became available too late to influence xterm.
1036
1037          If 16-color support is compiled, the following aixterm
1038          controls apply.  Assume that xterm's resources are set so that
1039          the ISO color codes are the first 8 of a set of 16.  Then the
1040          aixterm colors are the bright versions of the ISO colors:
1041
1042            Ps = 9 0  -> Set foreground color to Black.
1043            Ps = 9 1  -> Set foreground color to Red.
1044            Ps = 9 2  -> Set foreground color to Green.
1045            Ps = 9 3  -> Set foreground color to Yellow.
1046            Ps = 9 4  -> Set foreground color to Blue.
1047            Ps = 9 5  -> Set foreground color to Magenta.
1048            Ps = 9 6  -> Set foreground color to Cyan.
1049            Ps = 9 7  -> Set foreground color to White.
1050            Ps = 1 0 0  -> Set background color to Black.
1051            Ps = 1 0 1  -> Set background color to Red.
1052            Ps = 1 0 2  -> Set background color to Green.
1053            Ps = 1 0 3  -> Set background color to Yellow.
1054            Ps = 1 0 4  -> Set background color to Blue.
1055            Ps = 1 0 5  -> Set background color to Magenta.
1056            Ps = 1 0 6  -> Set background color to Cyan.
1057            Ps = 1 0 7  -> Set background color to White.
1058
1059          If xterm is compiled with the 16-color support disabled, it
1060          supports the following, from rxvt:
1061            Ps = 1 0 0  -> Set foreground and background color to
1062          default.
1063
1064          XTerm maintains a color palette whose entries are identified
1065          by an index beginning with zero.  If 88- or 256-color support
1066          is compiled, the following apply:
1067          o   All parameters are decimal integers.
1068          o   RGB values range from zero (0) to 255.
1069          o   The 88- and 256-color support uses subparameters described
1070              in ISO-8613-6 for indexed color.  ISO-8613-6 also mentions
1071              direct color, using a similar scheme.  xterm supports
1072              that, too.
1073          o   xterm allows either colons (standard) or semicolons
1074              (legacy) to separate the subparameters (but after the
1075              first colon, colons must be used).
1076
1077          The indexed- and direct-color features are summarized in the
1078          FAQ, which explains why semicolon is accepted as a
1079          subparameter delimiter:
1080
1081            Can I set a color by its number?
1082
1083
1084          These ISO-8613-6 controls (marked in ECMA-48 5th edition as
1085          "reserved for future standardization") are supported by xterm:
1086            Ps = 3 8 : 2 : Pi : Pr : Pg : Pb -> Set foreground color
1087          using RGB values.  If xterm is not compiled with direct-color
1088          support, it uses the closest match in its palette for the
1089          given RGB Pr/Pg/Pb.  The color space identifier Pi is ignored.
1090            Ps = 3 8 : 5 : Ps -> Set foreground color to Ps, using
1091          indexed color.
1092            Ps = 4 8 : 2 : Pi : Pr : Pg : Pb -> Set background color
1093          using RGB values.  If xterm is not compiled with direct-color
1094          support, it uses the closest match in its palette for the
1095          given RGB Pr/Pg/Pb.  The color space identifier Pi is ignored.
1096            Ps = 4 8 : 5 : Ps -> Set background color to Ps, using
1097          indexed color.
1098
1099          This variation on ISO-8613-6 is supported for compatibility
1100          with KDE konsole:
1101            Ps = 3 8 ; 2 ; Pr ; Pg ; Pb -> Set foreground color using
1102          RGB values.  If xterm is not compiled with direct-color
1103          support, it uses the closest match in its palette for the
1104          given RGB Pr/Pg/Pb.
1105            Ps = 4 8 ; 2 ; Pr ; Pg ; Pb -> Set background color using
1106          RGB values.  If xterm is not compiled with direct-color
1107          support, it uses the closest match in its palette for the
1108          given RGB Pr/Pg/Pb.
1109
1110          In each case, if xterm is compiled with direct-color support,
1111          and the resource directColor is true, then rather than
1112          choosing the closest match, xterm asks the X server to
1113          directly render a given color.
1114
1115CSI > Pp ; Pv m
1116CSI > Pp m
1117          Set/reset key modifier options (XTMODKEYS), xterm.  Set or
1118          reset resource-values used by xterm to decide whether to
1119          construct escape sequences holding information about the
1120          modifiers pressed with a given key.
1121
1122          The first parameter Pp identifies the resource to set/reset.
1123          The second parameter Pv is the value to assign to the
1124          resource.
1125
1126          If the second parameter is omitted, the resource is reset to
1127          its initial value.  Values 3  and 5  are reserved for keypad-
1128          keys and string-keys.
1129
1130            Pp = 0  -> modifyKeyboard.
1131            Pp = 1  -> modifyCursorKeys.
1132            Pp = 2  -> modifyFunctionKeys.
1133            Pp = 4  -> modifyOtherKeys.
1134
1135          If no parameters are given, all resources are reset to their
1136          initial values.
1137
1138CSI Ps n  Device Status Report (DSR).
1139            Ps = 5  -> Status Report.
1140          Result ("OK") is CSI 0 n
1141            Ps = 6  -> Report Cursor Position (CPR) [row;column].
1142          Result is CSI r ; c R
1143
1144          Note: it is possible for this sequence to be sent by a
1145          function key.  For example, with the default keyboard
1146          configuration the shifted F1 key may send (with shift-,
1147          control-, alt-modifiers)
1148
1149            CSI 1 ; 2  R , or
1150            CSI 1 ; 5  R , or
1151            CSI 1 ; 6  R , etc.
1152
1153          The second parameter encodes the modifiers; values range from
1154          2 to 16.  See the section PC-Style Function Keys for the
1155          codes.  The modifyFunctionKeys and modifyKeyboard resources
1156          can change the form of the string sent from the modified F1
1157          key.
1158
1159CSI > Ps n
1160          Disable key modifier options, xterm.  These modifiers may be
1161          enabled via the CSI > Pm m sequence.  This control sequence
1162          corresponds to a resource value of "-1", which cannot be set
1163          with the other sequence.
1164
1165          The parameter identifies the resource to be disabled:
1166
1167            Ps = 0  -> modifyKeyboard.
1168            Ps = 1  -> modifyCursorKeys.
1169            Ps = 2  -> modifyFunctionKeys.
1170            Ps = 4  -> modifyOtherKeys.
1171
1172          If the parameter is omitted, modifyFunctionKeys is disabled.
1173          When modifyFunctionKeys is disabled, xterm uses the modifier
1174          keys to make an extended sequence of function keys rather than
1175          adding a parameter to each function key to denote the
1176          modifiers.
1177
1178CSI ? Ps n
1179          Device Status Report (DSR, DEC-specific).
1180            Ps = 6  -> Report Cursor Position (DECXCPR).  The response
1181          [row;column] is returned as
1182          CSI ? r ; c R
1183          (assumes the default page, i.e., "1").
1184            Ps = 1 5  -> Report Printer status.  The response is
1185          CSI ? 1 0 n  (ready).  or
1186          CSI ? 1 1 n  (not ready).
1187            Ps = 2 5  -> Report UDK status.  The response is
1188          CSI ? 2 0 n  (unlocked)
1189          or
1190          CSI ? 2 1 n  (locked).
1191            Ps = 2 6  -> Report Keyboard status.  The response is
1192          CSI ? 2 7 ; 1 ; 0 ; 0 n  (North American).
1193
1194          The last two parameters apply to VT300 & up (keyboard ready)
1195          and VT400 & up (LK01) respectively.
1196
1197            Ps = 5 3  -> Report Locator status.  The response is CSI ? 5
1198          3 n  Locator available, if compiled-in, or CSI ? 5 0 n  No
1199          Locator, if not.
1200            Ps = 5 5  -> Report Locator status.  The response is CSI ? 5
1201          3 n  Locator available, if compiled-in, or CSI ? 5 0 n  No
1202          Locator, if not.
1203            Ps = 5 6  -> Report Locator type.  The response is CSI ? 5 7
1204          ; 1 n  Mouse, if compiled-in, or CSI ? 5 7 ; 0 n  Cannot
1205          identify, if not.
1206            Ps = 6 2  -> Report macro space (DECMSR).  The response is
1207          CSI Pn *  { .
1208            Ps = 6 3  -> Report memory checksum (DECCKSR), VT420 and up.
1209          The response is DCS Pt ! ~ x x x x ST .
1210              Pt is the request id (from an optional parameter to the
1211          request).
1212              The x's are hexadecimal digits 0-9 and A-F.
1213            Ps = 7 5  -> Report data integrity.  The response is CSI ? 7
1214          0 n  (ready, no errors).
1215            Ps = 8 5  -> Report multi-session configuration.  The
1216          response is CSI ? 8 3 n  (not configured for multiple-session
1217          operation).
1218
1219CSI > Ps p
1220          Set resource value pointerMode (XTSMPOINTER), xterm.  This is
1221          used by xterm to decide whether to hide the pointer cursor as
1222          the user types.
1223
1224          Valid values for the parameter:
1225            Ps = 0  -> never hide the pointer.
1226            Ps = 1  -> hide if the mouse tracking mode is not enabled.
1227            Ps = 2  -> always hide the pointer, except when leaving the
1228          window.
1229            Ps = 3  -> always hide the pointer, even if leaving/entering
1230          the window.
1231
1232          If no parameter is given, xterm uses the default, which is 1 .
1233
1234CSI ! p   Soft terminal reset (DECSTR), VT220 and up.
1235
1236CSI Pl ; Pc " p
1237          Set conformance level (DECSCL), VT220 and up.
1238
1239          The first parameter selects the conformance level.  Valid
1240          values are:
1241            Pl = 6 1  -> level 1, e.g., VT100.
1242            Pl = 6 2  -> level 2, e.g., VT200.
1243            Pl = 6 3  -> level 3, e.g., VT300.
1244            Pl = 6 4  -> level 4, e.g., VT400.
1245            Pl = 6 5  -> level 5, e.g., VT500.
1246
1247          The second parameter selects the C1 control transmission mode.
1248          This is an optional parameter, ignored in conformance level 1.
1249          Valid values are:
1250            Pc = 0  -> 8-bit controls.
1251            Pc = 1  -> 7-bit controls (DEC factory default).
1252            Pc = 2  -> 8-bit controls.
1253
1254          The 7-bit and 8-bit control modes can also be set by S7C1T and
1255          S8C1T, but DECSCL is preferred.
1256
1257CSI Ps $ p
1258          Request ANSI mode (DECRQM).  For VT300 and up, reply DECRPM is
1259            CSI Ps; Pm $ y
1260          where Ps is the mode number as in SM/RM, and Pm is the mode
1261          value:
1262            0 - not recognized
1263            1 - set
1264            2 - reset
1265            3 - permanently set
1266            4 - permanently reset
1267
1268CSI ? Ps $ p
1269          Request DEC private mode (DECRQM).  For VT300 and up, reply
1270          DECRPM is
1271            CSI ? Ps; Pm $ y
1272          where Ps is the mode number as in DECSET/DECSET, Pm is the
1273          mode value as in the ANSI DECRQM.
1274          Two private modes are read-only (i.e., 1 3  and 1 4 ),
1275          provided only for reporting their values using this control
1276          sequence.  They correspond to the resources cursorBlink and
1277          cursorBlinkXOR.
1278CSI # p
1279CSI Pm # p
1280          Push video attributes onto stack (XTPUSHSGR), xterm.  This is
1281          an alias for CSI # { , used to work around language
1282          limitations of C#.
1283
1284CSI > Ps q
1285          Ps = 0  -> Report xterm name and version (XTVERSION).  The
1286          response is a DSR sequence identifying the version: DCS > |
1287          text ST
1288
1289CSI Ps q  Load LEDs (DECLL), VT100.
1290            Ps = 0  -> Clear all LEDS (default).
1291            Ps = 1  -> Light Num Lock.
1292            Ps = 2  -> Light Caps Lock.
1293            Ps = 3  -> Light Scroll Lock.
1294            Ps = 2 1  -> Extinguish Num Lock.
1295            Ps = 2 2  -> Extinguish Caps Lock.
1296            Ps = 2 3  -> Extinguish Scroll Lock.
1297
1298CSI Ps SP q
1299          Set cursor style (DECSCUSR), VT520.
1300            Ps = 0  -> blinking block.
1301            Ps = 1  -> blinking block (default).
1302            Ps = 2  -> steady block.
1303            Ps = 3  -> blinking underline.
1304            Ps = 4  -> steady underline.
1305            Ps = 5  -> blinking bar, xterm.
1306            Ps = 6  -> steady bar, xterm.
1307
1308CSI Ps " q
1309          Select character protection attribute (DECSCA), VT220.  Valid
1310          values for the parameter:
1311            Ps = 0  -> DECSED and DECSEL can erase (default).
1312            Ps = 1  -> DECSED and DECSEL cannot erase.
1313            Ps = 2  -> DECSED and DECSEL can erase.
1314
1315CSI # q   Pop video attributes from stack (XTPOPSGR), xterm.  This is an
1316          alias for CSI # } , used to work around language limitations
1317          of C#.
1318
1319CSI Ps ; Ps r
1320          Set Scrolling Region [top;bottom] (default = full size of
1321          window) (DECSTBM), VT100.
1322
1323CSI ? Pm r
1324          Restore DEC Private Mode Values (XTRESTORE), xterm.  The value
1325          of Ps previously saved is restored.  Ps values are the same as
1326          for DECSET.
1327
1328CSI Pt ; Pl ; Pb ; Pr ; Ps $ r
1329          Change Attributes in Rectangular Area (DECCARA), VT400 and up.
1330            Pt ; Pl ; Pb ; Pr denotes the rectangle.
1331            Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7.
1332
1333CSI s     Save cursor, available only when DECLRMM is disabled (SCOSC,
1334          also ANSI.SYS).
1335
1336CSI Pl ; Pr s
1337          Set left and right margins (DECSLRM), VT420 and up.  This is
1338          available only when DECLRMM is enabled.
1339
1340CSI > Ps s
1341          Set/reset shift-escape options (XTSHIFTESCAPE), xterm.  This
1342          corresponds to the shiftEscape resource.
1343
1344          Valid values for the parameter:
1345            Ps = 0  -> allow shift-key to override mouse protocol.
1346            Ps = 1  -> conditionally allow shift-key as modifier in
1347          mouse protocol.
1348
1349          These resource values are disallowed in the control sequence:
1350            Ps = 2  -> always allow shift-key as modifier in mouse
1351          protocol.
1352            Ps = 3  -> never allow shift-key as modifier in mouse
1353          protocol.
1354
1355          If no parameter is given, xterm uses the default, which is 0 .
1356
1357CSI ? Pm s
1358          Save DEC Private Mode Values (XTSAVE), xterm.  Ps values are
1359          the same as for DECSET.
1360
1361CSI Ps ; Ps ; Ps t
1362          Window manipulation (XTWINOPS), dtterm, extended by xterm.
1363          These controls may be disabled using the allowWindowOps
1364          resource.
1365
1366          xterm uses Extended Window Manager Hints (EWMH) to maximize
1367          the window.  Some window managers have incomplete support for
1368          EWMH.  For instance, fvwm, flwm and quartz-wm advertise
1369          support for maximizing windows horizontally or vertically, but
1370          in fact equate those to the maximize operation.
1371
1372          Valid values for the first (and any additional parameters)
1373          are:
1374            Ps = 1  -> De-iconify window.
1375            Ps = 2  -> Iconify window.
1376            Ps = 3 ;  x ;  y -> Move window to [x, y].
1377            Ps = 4 ;  height ;  width -> Resize the xterm window to
1378          given height and width in pixels.  Omitted parameters reuse
1379          the current height or width.  Zero parameters use the
1380          display's height or width.
1381            Ps = 5  -> Raise the xterm window to the front of the
1382          stacking order.
1383            Ps = 6  -> Lower the xterm window to the bottom of the
1384          stacking order.
1385            Ps = 7  -> Refresh the xterm window.
1386            Ps = 8 ;  height ;  width -> Resize the text area to given
1387          height and width in characters.  Omitted parameters reuse the
1388          current height or width.  Zero parameters use the display's
1389          height or width.
1390            Ps = 9 ;  0  -> Restore maximized window.
1391            Ps = 9 ;  1  -> Maximize window (i.e., resize to screen
1392          size).
1393            Ps = 9 ;  2  -> Maximize window vertically.
1394            Ps = 9 ;  3  -> Maximize window horizontally.
1395            Ps = 1 0 ;  0  -> Undo full-screen mode.
1396            Ps = 1 0 ;  1  -> Change to full-screen.
1397            Ps = 1 0 ;  2  -> Toggle full-screen.
1398            Ps = 1 1  -> Report xterm window state.
1399          If the xterm window is non-iconified, it returns CSI 1 t .
1400          If the xterm window is iconified, it returns CSI 2 t .
1401            Ps = 1 3  -> Report xterm window position.
1402          Note: X Toolkit positions can be negative, but the reported
1403          values are unsigned, in the range 0-65535.  Negative values
1404          correspond to 32768-65535.
1405          Result is CSI 3 ; x ; y t
1406            Ps = 1 3 ;  2  -> Report xterm text-area position.
1407          Result is CSI 3 ; x ; y t
1408            Ps = 1 4  -> Report xterm text area size in pixels.
1409          Result is CSI  4 ;  height ;  width t
1410            Ps = 1 4 ;  2  -> Report xterm window size in pixels.
1411          Normally xterm's window is larger than its text area, since it
1412          includes the frame (or decoration) applied by the window
1413          manager, as well as the area used by a scroll-bar.
1414          Result is CSI  4 ;  height ;  width t
1415            Ps = 1 5  -> Report size of the screen in pixels.
1416          Result is CSI  5 ;  height ;  width t
1417            Ps = 1 6  -> Report xterm character cell size in pixels.
1418          Result is CSI  6 ;  height ;  width t
1419            Ps = 1 8  -> Report the size of the text area in characters.
1420          Result is CSI  8 ;  height ;  width t
1421            Ps = 1 9  -> Report the size of the screen in characters.
1422          Result is CSI  9 ;  height ;  width t
1423            Ps = 2 0  -> Report xterm window's icon label.
1424          Result is OSC  L  label ST
1425            Ps = 2 1  -> Report xterm window's title.
1426          Result is OSC  l  label ST
1427            Ps = 2 2 ; 0  -> Save xterm icon and window title on stack.
1428            Ps = 2 2 ; 1  -> Save xterm icon title on stack.
1429            Ps = 2 2 ; 2  -> Save xterm window title on stack.
1430            Ps = 2 3 ; 0  -> Restore xterm icon and window title from
1431          stack.
1432            Ps = 2 3 ; 1  -> Restore xterm icon title from stack.
1433            Ps = 2 3 ; 2  -> Restore xterm window title from stack.
1434            Ps >= 2 4  -> Resize to Ps lines (DECSLPP), VT340 and VT420.
1435          xterm adapts this by resizing its window.
1436
1437CSI > Pm t
1438          This xterm control sets one or more features of the title
1439          modes (XTSMTITLE), xterm.  Each parameter enables a single
1440          feature.
1441            Ps = 0  -> Set window/icon labels using hexadecimal.
1442            Ps = 1  -> Query window/icon labels using hexadecimal.
1443            Ps = 2  -> Set window/icon labels using UTF-8.
1444            Ps = 3  -> Query window/icon labels using UTF-8.  (See
1445          discussion of Title Modes)
1446
1447CSI Ps SP t
1448          Set warning-bell volume (DECSWBV), VT520.
1449            Ps = 0  or 1  -> off.
1450            Ps = 2 , 3  or 4  -> low.
1451            Ps = 5 , 6 , 7 , or 8  -> high.
1452
1453CSI Pt ; Pl ; Pb ; Pr ; Ps $ t
1454          Reverse Attributes in Rectangular Area (DECRARA), VT400 and
1455          up.
1456            Pt ; Pl ; Pb ; Pr denotes the rectangle.
1457            Ps denotes the attributes to reverse, i.e.,  1, 4, 5, 7.
1458
1459CSI u     Restore cursor (SCORC, also ANSI.SYS).
1460
1461CSI Ps SP u
1462          Set margin-bell volume (DECSMBV), VT520.
1463            Ps = 0 , 5 , 6 , 7 , or 8  -> high.
1464            Ps = 1  -> off.
1465            Ps = 2 , 3  or 4  -> low.
1466
1467CSI Pt ; Pl ; Pb ; Pr ; Pp ; Pt ; Pl ; Pp $ v
1468          Copy Rectangular Area (DECCRA), VT400 and up.
1469            Pt ; Pl ; Pb ; Pr denotes the rectangle.
1470            Pp denotes the source page.
1471            Pt ; Pl denotes the target location.
1472            Pp denotes the target page.
1473
1474CSI Ps $ w
1475          Request presentation state report (DECRQPSR), VT320 and up.
1476            Ps = 0  -> error.
1477            Ps = 1  -> cursor information report (DECCIR).
1478          Response is
1479            DCS 1 $ u Pt ST
1480          Refer to the VT420 programming manual, which requires six
1481          pages to document the data string Pt,
1482            Ps = 2  -> tab stop report (DECTABSR).
1483          Response is
1484            DCS 2 $ u Pt ST
1485          The data string Pt is a list of the tab-stops, separated by
1486          "/" characters.
1487
1488CSI Pt ; Pl ; Pb ; Pr ' w
1489          Enable Filter Rectangle (DECEFR), VT420 and up.
1490          Parameters are [top;left;bottom;right].
1491          Defines the coordinates of a filter rectangle and activates
1492          it.  Anytime the locator is detected outside of the filter
1493          rectangle, an outside rectangle event is generated and the
1494          rectangle is disabled.  Filter rectangles are always treated
1495          as "one-shot" events.  Any parameters that are omitted default
1496          to the current locator position.  If all parameters are
1497          omitted, any locator motion will be reported.  DECELR always
1498          cancels any previous rectangle definition.
1499
1500CSI Ps x  Request Terminal Parameters (DECREQTPARM).
1501          if Ps is a "0" (default) or "1", and xterm is emulating VT100,
1502          the control sequence elicits a response of the same form whose
1503          parameters describe the terminal:
1504            Ps -> the given Ps incremented by 2.
1505            Pn = 1  <- no parity.
1506            Pn = 1  <- eight bits.
1507            Pn = 1  <- 2 8  transmit 38.4k baud.
1508            Pn = 1  <- 2 8  receive 38.4k baud.
1509            Pn = 1  <- clock multiplier.
1510            Pn = 0  <- STP flags.
1511
1512CSI Ps * x
1513          Select Attribute Change Extent (DECSACE), VT420 and up.
1514            Ps = 0  -> from start to end position, wrapped.
1515            Ps = 1  -> from start to end position, wrapped.
1516            Ps = 2  -> rectangle (exact).
1517
1518CSI Pc ; Pt ; Pl ; Pb ; Pr $ x
1519          Fill Rectangular Area (DECFRA), VT420 and up.
1520            Pc is the character to use.
1521            Pt ; Pl ; Pb ; Pr denotes the rectangle.
1522
1523CSI Ps # y
1524          Select checksum extension (XTCHECKSUM), xterm.  The bits of Ps
1525          modify the calculation of the checksum returned by DECRQCRA:
1526            0  -> do not negate the result.
1527            1  -> do not report the VT100 video attributes.
1528            2  -> do not omit checksum for blanks.
1529            3  -> omit checksum for cells not explicitly initialized.
1530            4  -> do not mask cell value to 8 bits or ignore combining
1531          characters.
1532            5  -> do not mask cell value to 7 bits.
1533
1534CSI Pi ; Pg ; Pt ; Pl ; Pb ; Pr * y
1535          Request Checksum of Rectangular Area (DECRQCRA), VT420 and up.
1536          Response is
1537          DCS Pi ! ~ x x x x ST
1538            Pi is the request id.
1539            Pg is the page number.
1540            Pt ; Pl ; Pb ; Pr denotes the rectangle.
1541            The x's are hexadecimal digits 0-9 and A-F.
1542
1543CSI Ps ; Pu ' z
1544          Enable Locator Reporting (DECELR).
1545          Valid values for the first parameter:
1546            Ps = 0  -> Locator disabled (default).
1547            Ps = 1  -> Locator enabled.
1548            Ps = 2  -> Locator enabled for one report, then disabled.
1549          The second parameter specifies the coordinate unit for locator
1550          reports.
1551          Valid values for the second parameter:
1552            Pu = 0  or omitted -> default to character cells.
1553            Pu = 1  <- device physical pixels.
1554            Pu = 2  <- character cells.
1555
1556CSI Pt ; Pl ; Pb ; Pr $ z
1557          Erase Rectangular Area (DECERA), VT400 and up.
1558            Pt ; Pl ; Pb ; Pr denotes the rectangle.
1559
1560CSI Pm ' {
1561          Select Locator Events (DECSLE).
1562          Valid values for the first (and any additional parameters)
1563          are:
1564            Ps = 0  -> only respond to explicit host requests (DECRQLP).
1565          This is default.  It also cancels any filter rectangle.
1566            Ps = 1  -> report button down transitions.
1567            Ps = 2  -> do not report button down transitions.
1568            Ps = 3  -> report button up transitions.
1569            Ps = 4  -> do not report button up transitions.
1570
1571CSI # {
1572CSI Pm # {
1573          Push video attributes onto stack (XTPUSHSGR), xterm.  The
1574          optional parameters correspond to the SGR encoding for video
1575          attributes, except for colors (which do not have a unique SGR
1576          code):
1577            Ps = 1  -> Bold.
1578            Ps = 2  -> Faint.
1579            Ps = 3  -> Italicized.
1580            Ps = 4  -> Underlined.
1581            Ps = 5  -> Blink.
1582            Ps = 7  -> Inverse.
1583            Ps = 8  -> Invisible.
1584            Ps = 9  -> Crossed-out characters.
1585            Ps = 2 1  -> Doubly-underlined.
1586            Ps = 3 0  -> Foreground color.
1587            Ps = 3 1  -> Background color.
1588
1589          If no parameters are given, all of the video attributes are
1590          saved.  The stack is limited to 10 levels.
1591
1592CSI Pt ; Pl ; Pb ; Pr $ {
1593          Selective Erase Rectangular Area (DECSERA), VT400 and up.
1594            Pt ; Pl ; Pb ; Pr denotes the rectangle.
1595
1596CSI Pt ; Pl ; Pb ; Pr # |
1597          Report selected graphic rendition (XTREPORTSGR), xterm.  The
1598          response is an SGR sequence which contains the attributes
1599          which are common to all cells in a rectangle.
1600            Pt ; Pl ; Pb ; Pr denotes the rectangle.
1601
1602CSI Ps $ |
1603          Select columns per page (DECSCPP), VT340.
1604            Ps = 0  -> 80 columns, default if Ps omitted.
1605            Ps = 8 0  -> 80 columns.
1606            Ps = 1 3 2  -> 132 columns.
1607
1608CSI Ps ' |
1609          Request Locator Position (DECRQLP).
1610          Valid values for the parameter are:
1611            Ps = 0 , 1 or omitted -> transmit a single DECLRP locator
1612          report.
1613
1614          If Locator Reporting has been enabled by a DECELR, xterm will
1615          respond with a DECLRP Locator Report.  This report is also
1616          generated on button up and down events if they have been
1617          enabled with a DECSLE, or when the locator is detected outside
1618          of a filter rectangle, if filter rectangles have been enabled
1619          with a DECEFR.
1620
1621            <- CSI Pe ; Pb ; Pr ; Pc ; Pp &  w
1622
1623          Parameters are [event;button;row;column;page].
1624          Valid values for the event:
1625            Pe = 0  <- locator unavailable - no other parameters sent.
1626            Pe = 1  <- request - xterm received a DECRQLP.
1627            Pe = 2  <- left button down.
1628            Pe = 3  <- left button up.
1629            Pe = 4  <- middle button down.
1630            Pe = 5  <- middle button up.
1631            Pe = 6  <- right button down.
1632            Pe = 7  <- right button up.
1633            Pe = 8  <- M4 button down.
1634            Pe = 9  <- M4 button up.
1635            Pe = 1 0  <- locator outside filter rectangle.
1636          The "button" parameter is a bitmask indicating which buttons
1637          are pressed:
1638            Pb = 0  <- no buttons down.
1639            Pb & 1  <- right button down.
1640            Pb & 2  <- middle button down.
1641            Pb & 4  <- left button down.
1642            Pb & 8  <- M4 button down.
1643          The "row" and "column" parameters are the coordinates of the
1644          locator position in the xterm window, encoded as ASCII
1645          decimal.
1646          The "page" parameter is not used by xterm.
1647
1648CSI Ps * |
1649          Select number of lines per screen (DECSNLS), VT420 and up.
1650
1651CSI # }   Pop video attributes from stack (XTPOPSGR), xterm.  Popping
1652          restores the video-attributes which were saved using XTPUSHSGR
1653          to their previous state.
1654
1655CSI Ps ' }
1656          Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.
1657
1658CSI Ps ' ~
1659          Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.
1660
1661
1662Operating System Commands
1663
1664OSC Ps ; Pt BEL
1665
1666OSC Ps ; Pt ST
1667          Set Text Parameters.  Some control sequences return
1668          information:
1669          o   For colors and font, if Pt is a "?", the control sequence
1670              elicits a response which consists of the control sequence
1671              which would set the corresponding value.
1672          o   The dtterm control sequences allow you to determine the
1673              icon name and window title.
1674
1675          XTerm accepts either BEL  or ST  for terminating OSC
1676          sequences, and when returning information, uses the same
1677          terminator used in a query.  While the latter is preferred,
1678          the former is supported for legacy applications:
1679          o   Although documented in the changes for X.V10R4 (December
1680              1986), BEL  as a string terminator dates from X11R4
1681              (December 1989).
1682          o   Since XFree86-3.1.2Ee (August 1996), xterm has accepted ST
1683              (the documented string terminator in ECMA-48).
1684
1685          Ps specifies the type of operation to perform:
1686            Ps = 0  -> Change Icon Name and Window Title to Pt.
1687            Ps = 1  -> Change Icon Name to Pt.
1688            Ps = 2  -> Change Window Title to Pt.
1689            Ps = 3  -> Set X property on top-level window.  Pt should be
1690          in the form "prop=value", or just "prop" to delete the
1691          property.
1692            Ps = 4 ; c ; spec -> Change Color Number c to the color
1693          specified by spec.  This can be a name or RGB specification as
1694          per XParseColor.  Any number of c/spec pairs may be given.
1695          The color numbers correspond to the ANSI colors 0-7, their
1696          bright versions 8-15, and if supported, the remainder of the
1697          88-color or 256-color table.
1698
1699          If a "?" is given rather than a name or RGB specification,
1700          xterm replies with a control sequence of the same form which
1701          can be used to set the corresponding color.  Because more than
1702          one pair of color number and specification can be given in one
1703          control sequence, xterm can make more than one reply.
1704
1705            Ps = 5 ; c ; spec -> Change Special Color Number c to the
1706          color specified by spec.  This can be a name or RGB
1707          specification as per XParseColor.  Any number of c/spec pairs
1708          may be given.  The special colors can also be set by adding
1709          the maximum number of colors to these codes in an OSC 4
1710          control:
1711
1712              Pc = 0  <- resource colorBD (BOLD).
1713              Pc = 1  <- resource colorUL (UNDERLINE).
1714              Pc = 2  <- resource colorBL (BLINK).
1715              Pc = 3  <- resource colorRV (REVERSE).
1716              Pc = 4  <- resource colorIT (ITALIC).
1717
1718            Ps = 6 ; c ; f -> Enable/disable Special Color Number c.
1719          The second parameter tells xterm to enable the corresponding
1720          color mode if nonzero, disable it if zero.  OSC 6  is the same
1721          as OSC 1 0 6 .
1722
1723          The 10 colors (below) which may be set or queried using 1 0
1724          through 1 9  are denoted dynamic colors, since the
1725          corresponding control sequences were the first means for
1726          setting xterm's colors dynamically, i.e., after it was
1727          started.  They are not the same as the ANSI colors (however,
1728          the dynamic text foreground and background colors are used
1729          when ANSI colors are reset using SGR 3 9  and 4 9 ,
1730          respectively).  These controls may be disabled using the
1731          allowColorOps resource.  At least one parameter is expected
1732          for Pt.  Each successive parameter changes the next color in
1733          the list.  The value of Ps tells the starting point in the
1734          list.  The colors are specified by name or RGB specification
1735          as per XParseColor.
1736
1737          If a "?" is given rather than a name or RGB specification,
1738          xterm replies with a control sequence of the same form which
1739          can be used to set the corresponding dynamic color.  Because
1740          more than one pair of color number and specification can be
1741          given in one control sequence, xterm can make more than one
1742          reply.
1743
1744            Ps = 1 0  -> Change VT100 text foreground color to Pt.
1745            Ps = 1 1  -> Change VT100 text background color to Pt.
1746            Ps = 1 2  -> Change text cursor color to Pt.
1747            Ps = 1 3  -> Change pointer foreground color to Pt.
1748            Ps = 1 4  -> Change pointer background color to Pt.
1749            Ps = 1 5  -> Change Tektronix foreground color to Pt.
1750            Ps = 1 6  -> Change Tektronix background color to Pt.
1751            Ps = 1 7  -> Change highlight background color to Pt.
1752            Ps = 1 8  -> Change Tektronix cursor color to Pt.
1753            Ps = 1 9  -> Change highlight foreground color to Pt.
1754
1755            Ps = 4 6  -> Change Log File to Pt.  This is normally
1756          disabled by a compile-time option.
1757
1758            Ps = 5 0  -> Set Font to Pt.  These controls may be disabled
1759          using the allowFontOps resource.  If Pt begins with a "#",
1760          index in the font menu, relative (if the next character is a
1761          plus or minus sign) or absolute.  A number is expected but not
1762          required after the sign (the default is the current entry for
1763          relative, zero for absolute indexing).
1764
1765          The same rule (plus or minus sign, optional number) is used
1766          when querying the font.  The remainder of Pt is ignored.
1767
1768          A font can be specified after a "#" index expression, by
1769          adding a space and then the font specifier.
1770
1771          If the TrueType Fonts menu entry is set (the renderFont
1772          resource), then this control sets/queries the faceName
1773          resource.
1774
1775            Ps = 5 1  -> reserved for Emacs shell.
1776
1777            Ps = 5 2  -> Manipulate Selection Data.  These controls may
1778          be disabled using the allowWindowOps resource.  The parameter
1779          Pt is parsed as
1780               Pc ; Pd
1781          The first, Pc, may contain zero or more characters from the
1782          set c , p , q , s , 0 , 1 , 2 , 3 , 4 , 5 , 6 , and 7 .  It is
1783          used to construct a list of selection parameters for
1784          clipboard, primary, secondary, select, or cut buffers 0
1785          through 7 respectively, in the order given.  If the parameter
1786          is empty, xterm uses s 0 , to specify the configurable
1787          primary/clipboard selection and cut buffer 0.
1788
1789          The second parameter, Pd, gives the selection data.  Normally
1790          this is a string encoded in base64 (RFC-4648).  The data
1791          becomes the new selection, which is then available for pasting
1792          by other applications.
1793
1794          If the second parameter is a ? , xterm replies to the host
1795          with the selection data encoded using the same protocol.  It
1796          uses the first selection found by asking successively for each
1797          item from the list of selection parameters.
1798
1799          If the second parameter is neither a base64 string nor ? ,
1800          then the selection is cleared.
1801
1802            Ps = 1 0 4 ; c -> Reset Color Number c.  It is reset to the
1803          color specified by the corresponding X resource.  Any number
1804          of c parameters may be given.  These parameters correspond to
1805          the ANSI colors 0-7, their bright versions 8-15, and if
1806          supported, the remainder of the 88-color or 256-color table.
1807          If no parameters are given, the entire table will be reset.
1808
1809            Ps = 1 0 5 ; c -> Reset Special Color Number c.  It is reset
1810          to the color specified by the corresponding X resource.  Any
1811          number of c parameters may be given.  These parameters
1812          correspond to the special colors which can be set using an OSC
1813          5  control (or by adding the maximum number of colors using an
1814          OSC 4  control).
1815
1816            Ps = 1 0 6 ; c ; f -> Enable/disable Special Color Number c.
1817          The second parameter tells xterm to enable the corresponding
1818          color mode if nonzero, disable it if zero.
1819
1820              Pc = 0  <- resource colorBDMode (BOLD).
1821              Pc = 1  <- resource colorULMode (UNDERLINE).
1822              Pc = 2  <- resource colorBLMode (BLINK).
1823              Pc = 3  <- resource colorRVMode (REVERSE).
1824              Pc = 4  <- resource colorITMode (ITALIC).
1825              Pc = 5  <- resource colorAttrMode (Override ANSI).
1826
1827          The dynamic colors can also be reset to their default
1828          (resource) values:
1829            Ps = 1 1 0  -> Reset VT100 text foreground color.
1830            Ps = 1 1 1  -> Reset VT100 text background color.
1831            Ps = 1 1 2  -> Reset text cursor color.
1832            Ps = 1 1 3  -> Reset pointer foreground color.
1833            Ps = 1 1 4  -> Reset pointer background color.
1834            Ps = 1 1 5  -> Reset Tektronix foreground color.
1835            Ps = 1 1 6  -> Reset Tektronix background color.
1836            Ps = 1 1 7  -> Reset highlight color.
1837            Ps = 1 1 8  -> Reset Tektronix cursor color.
1838            Ps = 1 1 9  -> Reset highlight foreground color.
1839
1840            Ps = I  ; c -> Set icon to file.  Sun shelltool, CDE dtterm.
1841          The file is expected to be XPM format, and uses the same
1842          search logic as the iconHint resource.
1843
1844            Ps = l  ; c -> Set window title.  Sun shelltool, CDE dtterm.
1845
1846            Ps = L  ; c -> Set icon label.  Sun shelltool, CDE dtterm.
1847
1848
1849Privacy Message
1850
1851PM Pt ST  xterm implements no PM  functions; Pt is ignored.  Pt need not
1852          be printable characters.
1853
1854
1855Alt and Meta Keys
1856
1857Many keyboards have keys labeled "Alt".  Few have keys labeled "Meta".
1858However, xterm's default translations use the Meta modifier.  Common
1859keyboard configurations assign the Meta modifier to an "Alt" key.  By
1860using xmodmap one may have the modifier assigned to a different key, and
1861have "real" alt and meta keys.  Here is an example:
1862
1863     ! put meta on mod3 to distinguish it from alt
1864     keycode 64 = Alt_L
1865     clear mod1
1866     add mod1 = Alt_L
1867     keycode 115 = Meta_L
1868     clear mod3
1869     add mod3 = Meta_L
1870
1871
1872The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set)
1873can be used to control the way the Meta modifier applies to ordinary
1874keys unless the modifyOtherKeys resource is set:
1875
1876o   prefix a key with the ESC  character.
1877
1878o   shift the key from codes 0-127 to 128-255 by adding 128.
1879
1880When modifyOtherKeys is set, ordinary keys may be sent as escape
1881sequences:
1882
1883o   When modifyOtherKeys is set to 1, only the alt- and meta-modifiers
1884    apply.  For example, alt-Tab sends CSI 2 7 ; 3 ; 9 ~ (the second
1885    parameter is "3" for alt, and the third parameter is the ASCII value
1886    of tab, "9").
1887
1888o   When modifyOtherKeys is set to 2, all of the modifiers apply.  For
1889    example, shift-Tab sends CSI 2 7 ; 2 ; 9 ~ rather than CSI Z (the
1890    second parameter is "2" for shift).
1891
1892The formatOtherKeys resource tells n  to change the format of the escape
1893sequences sent when modifyOtherKeys applies.  When modifyOtherKeys is
1894set to 1, for example alt-Tab sends CSI 9 ; 3 u (changing the order of
1895parameters).  One drawback to this format is that applications may
1896confuse it with CSI u  (restore-cursor).
1897
1898The xterm FAQ sections
1899
1900   How can my program distinguish control-I from tab?
1901
1902   XTerm - "Other" Modified Keys
1903
1904go into greater detail on this topic.
1905
1906The table shows the result for a given character "x" with modifiers
1907according to the default translations with the resources set on or off.
1908This assumes altIsNotMeta is set:
1909
1910       -----------------------------------------------------------
1911       key          altSendsEscape   metaSendsEscape   result
1912       -----------+----------------+-----------------+------------
1913       x          | off            | off             | x
1914       Meta-x     | off            | off             | shift
1915       Alt-x      | off            | off             | shift
1916       Alt+Meta-x | off            | off             | shift
1917       x          | ON             | off             | x
1918       Meta-x     | ON             | off             | shift
1919       Alt-x      | ON             | off             | ESC  x
1920       Alt+Meta-x | ON             | off             | ESC  shift
1921       x          | off            | ON              | x
1922       Meta-x     | off            | ON              | ESC  x
1923       Alt-x      | off            | ON              | shift
1924       Alt+Meta-x | off            | ON              | ESC  shift
1925       x          | ON             | ON              | x
1926       Meta-x     | ON             | ON              | ESC  x
1927       Alt-x      | ON             | ON              | ESC  x
1928       Alt+Meta-x | ON             | ON              | ESC  x
1929       -----------+----------------+-----------------+------------
1930
1931
1932
1933PC-Style Function Keys
1934
1935If xterm does minimal translation of the function keys, it usually does
1936this with a PC-style keyboard, so PC-style function keys result.  Sun
1937keyboards are similar to PC keyboards.  Both have cursor and scrolling
1938operations printed on the keypad, which duplicate the smaller cursor and
1939scrolling keypads.
1940
1941X does not predefine NumLock (used for VT220 keyboards) or Alt (used as
1942an extension for the Sun/PC keyboards) as modifiers.  These keys are
1943recognized as modifiers when enabled by the numLock resource, or by the
1944"DECSET 1 0 3 5 " control sequence.
1945
1946The cursor keys transmit the following escape sequences depending on the
1947mode specified via the DECCKM escape sequence.
1948
1949                  Key            Normal     Application
1950                  -------------+----------+-------------
1951                  Cursor Up    | CSI A    | SS3 A
1952                  Cursor Down  | CSI B    | SS3 B
1953                  Cursor Right | CSI C    | SS3 C
1954                  Cursor Left  | CSI D    | SS3 D
1955                  -------------+----------+-------------
1956
1957The home- and end-keys (unlike PageUp and other keys also on the 6-key
1958editing keypad) are considered "cursor keys" by xterm.  Their mode is
1959also controlled by the DECCKM escape sequence:
1960
1961                    Key        Normal     Application
1962                    ---------+----------+-------------
1963                    Home     | CSI H    | SS3 H
1964                    End      | CSI F    | SS3 F
1965                    ---------+----------+-------------
1966
1967
1968The application keypad transmits the following escape sequences
1969depending on the mode specified via the DECKPNM and DECKPAM escape
1970sequences.  Use the NumLock key to override the application mode.
1971
1972Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are
1973supported by the program.
1974
1975      Key              Numeric    Application   Terminfo   Termcap
1976      ---------------+----------+-------------+----------+----------
1977      Space          | SP       | SS3 SP      | -        | -
1978      Tab            | TAB      | SS3 I       | -        | -
1979      Enter          | CR       | SS3 M       | kent     | @8
1980      PF1            | SS3 P    | SS3 P       | kf1      | k1
1981      PF2            | SS3 Q    | SS3 Q       | kf2      | k2
1982      PF3            | SS3 R    | SS3 R       | kf3      | k3
1983      PF4            | SS3 S    | SS3 S       | kf4      | k4
1984      * (multiply)   | *        | SS3 j       | -        | -
1985      + (add)        | +        | SS3 k       | -        | -
1986      , (comma)      | ,        | SS3 l       | -        | -
1987      - (minus)      | -        | SS3 m       | -        | -
1988      . (Delete)     | .        | CSI 3 ~     | -        | -
1989      / (divide)     | /        | SS3 o       | -        | -
1990      0 (Insert)     | 0        | CSI 2 ~     | -        | -
1991      1 (End)        | 1        | SS3 F       | kc1      | K4
1992      2 (DownArrow)  | 2        | CSI B       | -        | -
1993      3 (PageDown)   | 3        | CSI 6 ~     | kc3      | K5
1994      4 (LeftArrow)  | 4        | CSI D       | -        | -
1995      5 (Begin)      | 5        | CSI E       | kb2      | K2
1996      6 (RightArrow) | 6        | CSI C       | -        | -
1997      7 (Home)       | 7        | SS3 H       | ka1      | K1
1998      8 (UpArrow)    | 8        | CSI A       | -        | -
1999      9 (PageUp)     | 9        | CSI 5 ~     | ka3      | K3
2000      = (equal)      | =        | SS3 X       | -        | -
2001      ---------------+----------+-------------+----------+----------
2002
2003They also provide 12 function keys, as well as a few other special-
2004purpose keys:
2005
2006                       Key        Escape Sequence
2007                       ---------+-----------------
2008                       F1       | SS3 P
2009                       F2       | SS3 Q
2010                       F3       | SS3 R
2011                       F4       | SS3 S
2012                       F5       | CSI 1 5 ~
2013                       F6       | CSI 1 7 ~
2014                       F7       | CSI 1 8 ~
2015                       F8       | CSI 1 9 ~
2016                       F9       | CSI 2 0 ~
2017                       F10      | CSI 2 1 ~
2018                       F11      | CSI 2 3 ~
2019                       F12      | CSI 2 4 ~
2020                       ---------+-----------------
2021
2022
2023Note that F1 through F4 are prefixed with SS3 , while the other keys are
2024prefixed with CSI .  Older versions of xterm implement different escape
2025sequences for F1 through F4, with a CSI  prefix.  These can be activated
2026by setting the oldXtermFKeys resource.  However, since they do not
2027correspond to any hardware terminal, they have been deprecated.  (The
2028DEC VT220 reserves F1 through F5 for local functions such as Setup).
2029
2030                       Key        Escape Sequence
2031                       ---------+-----------------
2032                       F1       | CSI 1 1 ~
2033                       F2       | CSI 1 2 ~
2034                       F3       | CSI 1 3 ~
2035                       F4       | CSI 1 4 ~
2036                       ---------+-----------------
2037
2038In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is
2039false (and none of the other keyboard resources such as oldXtermFKeys
2040resource is set), xterm encodes function key modifiers as parameters
2041appended before the final character of the control sequence.  As a
2042special case, the SS3  sent before F1 through F4 is altered to CSI  when
2043sending a function key modifier as a parameter.
2044
2045                    Code     Modifiers
2046                  ---------+---------------------------
2047                     2     | Shift
2048                     3     | Alt
2049                     4     | Shift + Alt
2050                     5     | Control
2051                     6     | Shift + Control
2052                     7     | Alt + Control
2053                     8     | Shift + Alt + Control
2054                     9     | Meta
2055                     10    | Meta + Shift
2056                     11    | Meta + Alt
2057                     12    | Meta + Alt + Shift
2058                     13    | Meta + Ctrl
2059                     14    | Meta + Ctrl + Shift
2060                     15    | Meta + Ctrl + Alt
2061                     16    | Meta + Ctrl + Alt + Shift
2062                  ---------+---------------------------
2063
2064For example, shift-F5 would be sent as CSI 1 5 ; 2 ~
2065
2066If the alwaysUseMods resource is set, the Meta modifier also is
2067recognized, making parameters 9 through 16.
2068
2069The codes used for the PC-style function keys were inspired by a feature
2070of the VT510, referred to in its reference manual as DECFNK.  In the
2071DECFNK scheme, codes 2-8 identify modifiers for function-keys and
2072cursor-, editing-keypad keys.  Unlike xterm, the VT510 limits the
2073modifiers which can be used with cursor- and editing-keypad keys.
2074Although the name "DECFNK" implies that it is a mode, the VT510 manual
2075mentions it only as a feature, which (like xterm) interacts with the
2076DECUDK feature.  Unlike xterm, VT510/VT520 provide an extension to
2077DECUDK (DECPFK and DECPAK) which apparently was the reason for the
2078feature in those terminals, i.e., for identifying a programmable key
2079rather than making it simple for applications to obtain modifier
2080information.  It is not described in the related VT520 manual.  Neither
2081manual was readily available at the time the feature was added to xterm.
2082
2083On the other hand, the VT510 and VT520 reference manuals do document a
2084related feature.  That is its emulation of the SCO console, which is
2085similar to the "xterm-sco" terminal description.  The SCO console
2086function-keys are less useful to applications developers than the
2087approach used by xterm because
2088
2089o   the relationship between modifiers and the characters sent by
2090    function-keys is not readily apparent, and
2091
2092o   the scheme is not extensible, i.e., it is an ad hoc assignment
2093    limited to two modifiers (shift and control).
2094
2095
2096VT220-Style Function Keys
2097
2098However, xterm is most useful as a DEC VT102 or VT220 emulator.  Set the
2099sunKeyboard resource to true to force a Sun/PC keyboard to act like a
2100VT220 keyboard.
2101
2102The VT102/VT220 application keypad transmits unique escape sequences in
2103application mode, which are distinct from the cursor and scrolling
2104keypad:
2105
2106            Key            Numeric    Application   VT100?
2107            -------------+----------+-------------+----------
2108            Space        | SP       | SS3 SP      | no
2109            Tab          | TAB      | SS3 I       | no
2110            Enter        | CR       | SS3 M       | yes
2111            PF1          | SS3 P    | SS3 P       | yes
2112            PF2          | SS3 Q    | SS3 Q       | yes
2113            PF3          | SS3 R    | SS3 R       | yes
2114            PF4          | SS3 S    | SS3 S       | yes
2115            * (multiply) | *        | SS3 j       | no
2116            + (add)      | +        | SS3 k       | no
2117            , (comma)    | ,        | SS3 l       | yes
2118            - (minus)    | -        | SS3 m       | yes
2119            . (period)   | .        | SS3 n       | yes
2120            / (divide)   | /        | SS3 o       | no
2121            0            | 0        | SS3 p       | yes
2122            1            | 1        | SS3 q       | yes
2123            2            | 2        | SS3 r       | yes
2124            3            | 3        | SS3 s       | yes
2125            4            | 4        | SS3 t       | yes
2126            5            | 5        | SS3 u       | yes
2127            6            | 6        | SS3 v       | yes
2128            7            | 7        | SS3 w       | yes
2129            8            | 8        | SS3 x       | yes
2130            9            | 9        | SS3 y       | yes
2131            = (equal)    | =        | SS3 X       | no
2132            -------------+----------+-------------+----------
2133
2134
2135The VT100/VT220 keypad did not have all of those keys.  They were
2136implemented in xterm in X11R1 (1987), defining a mapping of all X11 keys
2137which might be provided on a keypad.  For instance, a Sun4/II type-4
2138keyboard provided "=" (equal), "/" (divide), and "*" (multiply).
2139
2140While the VT420 provided the same keypad, the VT520 used a PC-keyboard.
2141Because that keyboard's keypad lacks the "," (comma), it was not
2142possible to use EDT's delete-character function with the keypad.  XTerm
2143solves that problem for the VT220-keyboard configuration by mapping
2144
2145  Ctrl +  to ,  and
2146  Ctrl -  to -
2147
2148The VT220 provides a 6-key editing keypad, which is analogous to that on
2149the PC keyboard.  It is not affected by DECCKM or DECKPNM/DECKPAM:
2150
2151                   Key        Normal     Application
2152                   ---------+----------+-------------
2153                   Insert   | CSI 2 ~  | CSI 2 ~
2154                   Delete   | CSI 3 ~  | CSI 3 ~
2155                   Home     | CSI 1 ~  | CSI 1 ~
2156                   End      | CSI 4 ~  | CSI 4 ~
2157                   PageUp   | CSI 5 ~  | CSI 5 ~
2158                   PageDown | CSI 6 ~  | CSI 6 ~
2159                   ---------+----------+-------------
2160
2161
2162The VT220 provides 8 additional function keys.  With a Sun/PC keyboard,
2163access these keys by Control/F1 for F13, etc.
2164
2165                       Key        Escape Sequence
2166                       ---------+-----------------
2167                       F13      | CSI 2 5 ~
2168                       F14      | CSI 2 6 ~
2169                       F15      | CSI 2 8 ~
2170                       F16      | CSI 2 9 ~
2171                       F17      | CSI 3 1 ~
2172                       F18      | CSI 3 2 ~
2173                       F19      | CSI 3 3 ~
2174                       F20      | CSI 3 4 ~
2175                       ---------+-----------------
2176
2177
2178
2179VT52-Style Function Keys
2180
2181A VT52 does not have function keys, but it does have a numeric keypad
2182and cursor keys.  They differ from the other emulations by the prefix.
2183Also, the cursor keys do not change:
2184
2185                   Key            Normal/Application
2186                   -------------+--------------------
2187                   Cursor Up    | ESC A
2188                   Cursor Down  | ESC B
2189                   Cursor Right | ESC C
2190                   Cursor Left  | ESC D
2191                   -------------+--------------------
2192
2193The keypad is similar:
2194
2195            Key            Numeric    Application   VT52?
2196            -------------+----------+-------------+----------
2197            Space        | SP       | ESC ? SP    | no
2198            Tab          | TAB      | ESC ? I     | no
2199            Enter        | CR       | ESC ? M     | no
2200            PF1          | ESC P    | ESC P       | yes
2201            PF2          | ESC Q    | ESC Q       | yes
2202            PF3          | ESC R    | ESC R       | yes
2203            PF4          | ESC S    | ESC S       | no
2204            * (multiply) | *        | ESC ? j     | no
2205            + (add)      | +        | ESC ? k     | no
2206            , (comma)    | ,        | ESC ? l     | no
2207            - (minus)    | -        | ESC ? m     | no
2208            . (period)   | .        | ESC ? n     | yes
2209            / (divide)   | /        | ESC ? o     | no
2210            0            | 0        | ESC ? p     | yes
2211            1            | 1        | ESC ? q     | yes
2212            2            | 2        | ESC ? r     | yes
2213            3            | 3        | ESC ? s     | yes
2214            4            | 4        | ESC ? t     | yes
2215            5            | 5        | ESC ? u     | yes
2216            6            | 6        | ESC ? v     | yes
2217            7            | 7        | ESC ? w     | yes
2218            8            | 8        | ESC ? x     | yes
2219            9            | 9        | ESC ? y     | yes
2220            = (equal)    | =        | ESC ? X     | no
2221            -------------+----------+-------------+----------
2222
2223
2224
2225Sun-Style Function Keys
2226
2227The xterm program provides support for Sun keyboards more directly, by a
2228menu toggle that causes it to send Sun-style function key codes rather
2229than VT220.  Note, however, that the sun and VT100 emulations are not
2230really compatible.  For example, their wrap-margin behavior differs.
2231
2232Only function keys are altered; keypad and cursor keys are the same.
2233The emulation responds identically.  See the xterm-sun terminfo entry
2234for details.
2235
2236
2237HP-Style Function Keys
2238
2239Similarly, xterm can be compiled to support HP keyboards.  See the
2240xterm-hp terminfo entry for details.
2241
2242
2243The Alternate Screen Buffer
2244
2245XTerm maintains two screen buffers.  The Normal Screen Buffer allows you
2246to scroll back to view saved lines of output up to the maximum set by
2247the saveLines resource.  The Alternate Screen Buffer is exactly as large
2248as the display, contains no additional saved lines.  When the Alternate
2249Screen Buffer is active, you cannot scroll back to view saved lines.
2250XTerm provides control sequences and menu entries for switching between
2251the two.
2252
2253Most full-screen applications use terminfo or termcap to obtain strings
2254used to start/stop full-screen mode, i.e., smcup and rmcup for terminfo,
2255or the corresponding ti and te for termcap.  The titeInhibit resource
2256removes the ti and te strings from the TERMCAP string which is set in
2257the environment for some platforms.  That is not done when xterm is
2258built with terminfo libraries because terminfo does not provide the
2259whole text of the termcap data in one piece.  It would not work for
2260terminfo anyway, since terminfo data is not passed in environment
2261variables; setting an environment variable in this manner would have no
2262effect on the application's ability to switch between Normal and
2263Alternate Screen buffers.  Instead, the newer private mode controls
2264(such as 1 0 4 9 ) for switching between Normal and Alternate Screen
2265buffers simply disable the switching.  They add other features such as
2266clearing the display for the same reason: to make the details of
2267switching independent of the application that requests the switch.
2268
2269
2270Bracketed Paste Mode
2271
2272When bracketed paste mode is set, pasted text is bracketed with control
2273sequences so that the program can differentiate pasted text from typed-
2274in text.  When bracketed paste mode is set, the program will receive:
2275   ESC [ 2 0 0 ~ ,
2276followed by the pasted text, followed by
2277   ESC [ 2 0 1 ~ .
2278
2279
2280Title Modes
2281
2282The window- and icon-labels can be set or queried using control
2283sequences.  As a VT220-emulator, xterm "should" limit the character
2284encoding for the corresponding strings to ISO-8859-1.  Indeed, it used
2285to be the case (and was documented) that window titles had to be
2286ISO-8859-1.  This is no longer the case.  However, there are many
2287applications which still assume that titles are set using ISO-8859-1.
2288So that is the default behavior.
2289
2290If xterm is running with UTF-8 encoding, it is possible to use window-
2291and icon-labels encoded using UTF-8.  That is because the underlying X
2292libraries (and many, but not all) window managers support this feature.
2293
2294The utf8Title X resource setting tells xterm to disable a reconversion
2295of the title string back to ISO-8859-1, allowing the title strings to be
2296interpreted as UTF-8.  The same feature can be enabled using the title
2297mode control sequence described in this summary.
2298
2299Separate from the ability to set the titles, xterm provides the ability
2300to query the titles, returning them either in ISO-8859-1 or UTF-8.  This
2301choice is available only while xterm is using UTF-8 encoding.
2302
2303Finally, the characters sent to, or returned by a title control are less
2304constrained than the rest of the control sequences.  To make them more
2305manageable (and constrained), for use in shell scripts, xterm has an
2306optional feature which decodes the string from hexadecimal (for setting
2307titles) or for encoding the title into hexadecimal when querying the
2308value.
2309
2310
2311Mouse Tracking
2312
2313The VT widget can be set to send the mouse position and other
2314information on button presses.  These modes are typically used by
2315editors and other full-screen applications that want to make use of the
2316mouse.
2317
2318There are two sets of mutually exclusive modes:
2319
2320o   mouse protocol
2321
2322o   protocol encoding
2323
2324The mouse protocols include DEC Locator mode, enabled by the DECELR CSI
2325Ps ; Ps '  z control sequence, and is not described here (control
2326sequences are summarized above).  The remaining five modes of the mouse
2327protocols are each enabled (or disabled) by a different parameter in the
2328"DECSET CSI ? Pm h " or "DECRST CSI ? Pm l " control sequence.
2329
2330Manifest constants for the parameter values are defined in xcharmouse.h
2331as follows:
2332
2333     #define SET_X10_MOUSE               9
2334     #define SET_VT200_MOUSE             1000
2335     #define SET_VT200_HIGHLIGHT_MOUSE   1001
2336     #define SET_BTN_EVENT_MOUSE         1002
2337     #define SET_ANY_EVENT_MOUSE         1003
2338
2339     #define SET_FOCUS_EVENT_MOUSE       1004
2340
2341     #define SET_ALTERNATE_SCROLL        1007
2342
2343     #define SET_EXT_MODE_MOUSE          1005
2344     #define SET_SGR_EXT_MODE_MOUSE      1006
2345     #define SET_URXVT_EXT_MODE_MOUSE    1015
2346     #define SET_PIXEL_POSITION_MOUSE    1016
2347
2348The motion reporting modes are strictly xterm extensions, and are not
2349part of any standard, though they are analogous to the DEC VT200 DECELR
2350locator reports.
2351
2352Normally, parameters (such as pointer position and button number) for
2353all mouse tracking escape sequences generated by xterm encode numeric
2354parameters in a single character as value+32.  For example, !  specifies
2355the value 1.  The upper left character position on the terminal is
2356denoted as 1,1.  This scheme dates back to X10, though the normal mouse-
2357tracking (from X11) is more elaborate.
2358
2359
2360X10 compatibility mode
2361
2362X10 compatibility mode sends an escape sequence only on button press,
2363encoding the location and the mouse button pressed.  It is enabled by
2364specifying parameter 9 to DECSET.  On button press, xterm sends CSI M
2365CbCxCy (6 characters).
2366
2367o   Cb is button-1, where button is 1, 2 or 3.
2368
2369o   Cx and Cy are the x and y coordinates of the mouse when the button
2370    was pressed.
2371
2372
2373Normal tracking mode
2374
2375Normal tracking mode sends an escape sequence on both button press and
2376release.  Modifier key (shift, ctrl, meta) information is also sent.  It
2377is enabled by specifying parameter 1000 to DECSET.  On button press or
2378release, xterm sends CSI M CbCxCy.
2379
2380o   The low two bits of Cb encode button information:
2381
2382              0=MB1 pressed,
2383              1=MB2 pressed,
2384              2=MB3 pressed, and
2385              3=release.
2386
2387o   The next three bits encode the modifiers which were down when the
2388    button was pressed and are added together:
2389
2390              4=Shift,
2391              8=Meta, and
2392              16=Control.
2393
2394    The shift and control modifiers are normally irrelevant because
2395    xterm uses the control modifier with mouse for popup menus, and the
2396    shift modifier is used in the default translations for button
2397    events.
2398
2399    There is no predefined meta modifier.  XTerm checks first if the
2400    keysyms listed in the predefined modifiers include Meta_L or Meta_R.
2401    If found, xterm uses that modifier for meta.  Next, it tries Alt_L
2402    or Alt_R.  If none of those are found, xterm uses the mod1 modifier,
2403    This is not necessarily the "Meta" key according to xmodmap(1).
2404
2405o   Cx and Cy are the x and y coordinates of the mouse event, encoded as
2406    in X10 mode.
2407
2408
2409Wheel mice
2410
2411Wheel mice may return buttons 4 and 5.  Those buttons are represented by
2412the same event codes as buttons 1 and 2 respectively, except that 64 is
2413added to the event code.  Release events for the wheel buttons are not
2414reported.
2415
2416By default, the wheel mouse events (buttons 4 and 5) are translated to
2417scroll-back and scroll-forw actions, respectively.  Those actions
2418normally scroll the whole window, as if the scrollbar was used.
2419
2420However if Alternate Scroll mode is set, then cursor up/down controls
2421are sent when the terminal is displaying the Alternate Screen Buffer.
2422The initial state of Alternate Scroll mode is set using the
2423alternateScroll resource.
2424
2425
2426Other buttons
2427
2428Some wheel mice can send additional button events, e.g., by tilting the
2429scroll wheel left and right.
2430
2431Additional buttons are encoded like the wheel mice,
2432
2433o   by adding 64 (for buttons 6 and 7), or
2434
2435o   by adding 128 (for buttons 8 through 11).
2436
2437Past button 11, the encoding is ambiguous because the same code may
2438correspond to different button/modifier combinations.
2439
2440It is not possible to use these buttons (6-11) in xterm's translations
2441resource because their names are not in the X Toolkit's symbol table.
2442However, applications can check for the reports, e.g., button 7 (left)
2443and button 6 (right) with a Logitech mouse.
2444
2445
2446Highlight tracking
2447
2448Mouse highlight tracking notifies a program of a button press, receives
2449a range of lines from the program, highlights the region covered by the
2450mouse within that range until button release, and then sends the program
2451the release coordinates.  It is enabled by specifying parameter 1001 to
2452DECSET.  Highlighting is performed only for button 1, though other
2453button events can be received.
2454
2455Warning: this mode requires a cooperating program, else xterm will hang.
2456
2457On button press, the same information as for normal tracking is
2458generated; xterm then waits for the program to send mouse tracking
2459information.  All X events are ignored until the proper escape sequence
2460is received from the pty:
2461CSI Ps ; Ps ; Ps ; Ps ; Ps T
2462
2463The parameters are func, startx, starty, firstrow, and lastrow:
2464
2465o   func is non-zero to initiate highlight tracking and zero to abort.
2466
2467o   startx and starty give the starting x and y location for the
2468    highlighted region.
2469
2470o   The ending location tracks the mouse, but will never be above row
2471    firstrow and will always be above row lastrow.  (The top of the
2472    screen is row 1.)
2473
2474When the button is released, xterm reports the ending position one of
2475two ways:
2476
2477o   if the start and end coordinates are the same locations:
2478
2479    CSI t CxCy
2480
2481o   otherwise:
2482
2483    CSI T CxCyCxCyCxCy
2484
2485The parameters are startx, starty, endx, endy, mousex, and mousey:
2486
2487o   startx, starty, endx, and endy give the starting and ending
2488    character positions of the region.
2489
2490o   mousex and mousey give the location of the mouse at button up, which
2491    may not be over a character.
2492
2493
2494Button-event tracking
2495
2496Button-event tracking is essentially the same as normal tracking, but
2497xterm also reports button-motion events.  Motion events are reported
2498only if the mouse pointer has moved to a different character cell.  It
2499is enabled by specifying parameter 1002 to DECSET.  On button press or
2500release, xterm sends the same codes used by normal tracking mode.
2501
2502o   On button-motion events, xterm adds 32 to the event code (the third
2503    character, Cb).
2504
2505o   The other bits of the event code specify button and modifier keys as
2506    in normal mode.  For example, motion into cell x,y with button 1
2507    down is reported as
2508
2509    CSI M @ CxCy
2510
2511    ( @  = 32 + 0 (button 1) + 32 (motion indicator) ).  Similarly,
2512    motion with button 3 down is reported as
2513
2514    CSI M B CxCy
2515
2516    ( B  = 32 + 2 (button 3) + 32 (motion indicator) ).
2517
2518
2519Any-event tracking
2520
2521Any-event mode is the same as button-event mode, except that all motion
2522events are reported, even if no mouse button is down.  It is enabled by
2523specifying 1003 to DECSET.
2524
2525
2526FocusIn/FocusOut
2527
2528FocusIn/FocusOut can be combined with any of the mouse events since it
2529uses a different protocol.  When set, it causes xterm to send CSI I
2530when the terminal gains focus, and CSI O  when it loses focus.
2531
2532
2533Extended coordinates
2534
2535The original X10 mouse protocol limits the Cx and Cy ordinates to 223
2536(=255 - 32).  XTerm supports more than one scheme for extending this
2537range, by changing the protocol encoding:
2538
2539UTF-8 (1005)
2540          This enables UTF-8 encoding for Cx and Cy under all tracking
2541          modes, expanding the maximum encodable position from 223 to
2542          2015.  For positions less than 95, the resulting output is
2543          identical under both modes.  Under extended mouse mode,
2544          positions greater than 95 generate "extra" bytes which will
2545          confuse applications which do not treat their input as a UTF-8
2546          stream.  Likewise, Cb will be UTF-8 encoded, to reduce
2547          confusion with wheel mouse events.
2548
2549          Under normal mouse mode, positions outside (160,94) result in
2550          byte pairs which can be interpreted as a single UTF-8
2551          character; applications which do treat their input as UTF-8
2552          will almost certainly be confused unless extended mouse mode
2553          is active.
2554
2555          This scheme has the drawback that the encoded coordinates will
2556          not pass through luit(1) unchanged, e.g., for locales using
2557          non-UTF-8 encoding.
2558
2559SGR (1006)
2560          The normal mouse response is altered to use
2561
2562          o   CSI < followed by semicolon-separated
2563
2564          o   encoded button value,
2565
2566          o   Px and Py ordinates and
2567
2568          o   a final character which is M  for button press and m  for
2569              button release.
2570
2571          The encoded button value in this case does not add 32 since
2572          that was useful only in the X10 scheme for ensuring that the
2573          byte containing the button value is a printable code.
2574
2575          o   The modifiers are encoded in the same way.
2576
2577          o   A different final character is used for button release to
2578              resolve the X10 ambiguity regarding which button was
2579              released.
2580
2581          The highlight tracking responses are also modified to an SGR-
2582          like format, using the same SGR-style scheme and button-
2583          encodings.
2584
2585URXVT (1015)
2586          The normal mouse response is altered to use
2587
2588          o   CSI followed by semicolon-separated
2589
2590          o   encoded button value,
2591
2592          o   the Px and Py ordinates and final character M .
2593
2594          This uses the same button encoding as X10, but printing it as
2595          a decimal integer rather than as a single byte.
2596
2597          However, CSI M  can be mistaken for DL (delete lines), while
2598          the highlight tracking CSI T  can be mistaken for SD (scroll
2599          down), and the Window manipulation controls.  For these
2600          reasons, the 1015 control is not recommended; it is not an
2601          improvement over 1006.
2602
2603SGR-Pixels (1016)
2604          Use the same mouse response format as the 1006 control, but
2605          report position in pixels rather than character cells.
2606
2607
2608Sixel Graphics
2609
2610If xterm is configured as VT240, VT241, VT330, VT340 or VT382 using the
2611decTerminalID or decGraphicsID resource, it supports Sixel Graphics
2612controls, a palleted bitmap graphics system using sets of six vertical
2613pixels as the basic element.
2614
2615CSI Ps c  Send Device Attributes (Primary DA), xterm.  xterm responds to
2616          Send Device Attributes (Primary DA) with these additional
2617          codes:
2618            Ps = 4  -> Sixel graphics.
2619
2620CSI ? Pm h
2621          Set Mode, xterm.  xterm has these additional private Set Mode
2622          values:
2623            Ps = 8 0  -> Sixel scrolling.
2624            Ps = 1 0 7 0  -> use private color registers for each
2625          graphic.
2626            Ps = 8 4 5 2  -> Sixel scrolling leaves cursor to right of
2627          graphic.
2628
2629DCS Pa ; Pb ; Ph q  Ps..Ps ST
2630          Send SIXEL image, DEC graphics terminals, xterm.  See:
2631
2632             VT330/VT340 Programmer Reference Manual Volume 2:
2633             Graphics Programming
2634             Chapter 14 Graphics Programming
2635
2636          The sixel data device control string has three positional
2637          parameters, following the q  with sixel data.
2638            Pa -> pixel aspect ratio
2639            Pb -> background color option
2640            Ph -> horizontal grid size (ignored).
2641            Ps -> sixel data
2642
2643
2644ReGIS Graphics
2645
2646If xterm is configured as VT125, VT240, VT241, VT330 or VT340 using the
2647decTerminalID or decGraphicsID resource, it supports Remote Graphic
2648Instruction Set, a graphics description language.
2649
2650CSI Ps c  Send Device Attributes (Primary DA), DEC graphics terminals,
2651          xterm.  xterm responds to Send Device Attributes (Primary DA)
2652          with these additional codes:
2653            Ps = 3  -> ReGIS graphics.
2654
2655CSI ? Pm h
2656          Set Mode, xterm.  xterm has these additional private Set Mode
2657          values:
2658            Ps = 1 0 7 0  -> use private color registers for each
2659          graphic.
2660
2661DCS Pm p Pr..Pr ST
2662          Enter or exit ReGIS, VT300, xterm.  See:
2663
2664             VT330/VT340 Programmer Reference Manual Volume 2:
2665             Graphics Programming
2666             Chapter 1 Introduction to ReGIS
2667
2668          The ReGIS data device control string has one positional
2669          parameter with four possible values:
2670            Pm = 0 -> resume command, use fullscreen mode.
2671            Pm = 1 -> start new command, use fullscreen mode.
2672            Pm = 2 -> resume command, use command display mode.
2673            Pm = 3 -> start new command, use command display mode.
2674
2675
2676Tektronix 4014 Mode
2677
2678Most of these sequences are standard Tektronix 4014 control sequences.
2679Graph mode supports the 12-bit addressing of the Tektronix 4014.  The
2680major features missing are the write-through and defocused modes.  This
2681document does not describe the commands used in the various Tektronix
2682plotting modes but does describe the commands to switch modes.
2683
2684Some of the sequences are specific to xterm.  The Tektronix emulation
2685was added in X10R4 (1986).  The VT240, introduced two years earlier,
2686also supported Tektronix 4010/4014.  Unlike xterm, the VT240
2687documentation implies (there is an obvious error in section 6.9
2688"Entering and Exiting 4010/4014 Mode") that exiting back to ANSI mode is
2689done by resetting private mode 3 8  (DECTEK) rather than ESC ETX .  A
2690real Tektronix 4014 would not respond to either.
2691
2692BEL       Bell (Ctrl-G).
2693
2694BS        Backspace (Ctrl-H).
2695
2696TAB       Horizontal Tab (Ctrl-I).
2697
2698LF        Line Feed or New Line (Ctrl-J).
2699
2700VT        Cursor up (Ctrl-K).
2701
2702FF        Form Feed or New Page (Ctrl-L).
2703
2704CR        Carriage Return (Ctrl-M).
2705
2706ESC ETX   Switch to VT100 Mode (ESC  Ctrl-C).
2707
2708ESC ENQ   Return Terminal Status (ESC  Ctrl-E).
2709
2710ESC FF    PAGE (Clear Screen) (ESC  Ctrl-L).
2711
2712ESC SO    Begin 4015 APL mode (ESC  Ctrl-N).  This is ignored by xterm.
2713
2714ESC SI    End 4015 APL mode (ESC  Ctrl-O).  This is ignored by xterm.
2715
2716ESC ETB   COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss).
2717            ETB  (end transmission block) is the same as Ctrl-W.
2718
2719ESC CAN   Bypass Condition (ESC  Ctrl-X).
2720
2721ESC SUB   GIN mode (ESC  Ctrl-Z).
2722
2723ESC FS    Special Point Plot Mode (ESC  Ctrl-\).
2724
2725ESC 8     Select Large Character Set.
2726
2727ESC 9     Select #2 Character Set.
2728
2729ESC :     Select #3 Character Set.
2730
2731ESC ;     Select Small Character Set.
2732
2733OSC Ps ; Pt BEL
2734          Set Text Parameters of VT window.
2735            Ps = 0  -> Change Icon Name and Window Title to Pt.
2736            Ps = 1  -> Change Icon Name to Pt.
2737            Ps = 2  -> Change Window Title to Pt.
2738            Ps = 4 6  -> Change Log File to Pt.  This is normally
2739          disabled by a compile-time option.
2740
2741ESC `     Normal Z Axis and Normal (solid) Vectors.
2742
2743ESC a     Normal Z Axis and Dotted Line Vectors.
2744
2745ESC b     Normal Z Axis and Dot-Dashed Vectors.
2746
2747ESC c     Normal Z Axis and Short-Dashed Vectors.
2748
2749ESC d     Normal Z Axis and Long-Dashed Vectors.
2750
2751ESC h     Defocused Z Axis and Normal (solid) Vectors.
2752
2753ESC i     Defocused Z Axis and Dotted Line Vectors.
2754
2755ESC j     Defocused Z Axis and Dot-Dashed Vectors.
2756
2757ESC k     Defocused Z Axis and Short-Dashed Vectors.
2758
2759ESC l     Defocused Z Axis and Long-Dashed Vectors.
2760
2761ESC p     Write-Thru Mode and Normal (solid) Vectors.
2762
2763ESC q     Write-Thru Mode and Dotted Line Vectors.
2764
2765ESC r     Write-Thru Mode and Dot-Dashed Vectors.
2766
2767ESC s     Write-Thru Mode and Short-Dashed Vectors.
2768
2769ESC t     Write-Thru Mode and Long-Dashed Vectors.
2770
2771FS        Point Plot Mode (Ctrl-\).
2772
2773GS        Graph Mode (Ctrl-]).
2774
2775RS        Incremental Plot Mode (Ctrl-^ ).
2776
2777US        Alpha Mode (Ctrl-_).
2778
2779
2780VT52 Mode
2781
2782Parameters for cursor movement are at the end of the ESC Y  escape
2783sequence.  Each ordinate is encoded in a single character as value+32.
2784For example, !  is 1.  The screen coordinate system is 0-based.
2785
2786ESC <     Exit VT52 mode (Enter VT100 mode).
2787
2788ESC =     Enter alternate keypad mode.
2789
2790ESC >     Exit alternate keypad mode.
2791
2792ESC A     Cursor up.
2793
2794ESC B     Cursor down.
2795
2796ESC C     Cursor right.
2797
2798ESC D     Cursor left.
2799
2800ESC F     Enter graphics mode.
2801
2802ESC G     Exit graphics mode.
2803
2804ESC H     Move the cursor to the home position.
2805
2806ESC I     Reverse line feed.
2807
2808ESC J     Erase from the cursor to the end of the screen.
2809
2810ESC K     Erase from the cursor to the end of the line.
2811
2812ESC Y Ps Ps
2813          Move the cursor to given row and column.
2814
2815ESC Z     Identify.
2816            -> ESC  /  Z  ("I am a VT52.").
2817
2818
2819Further reading
2820
2821
2822Technical manuals
2823
2824Manuals for hardware terminals are more readily available than
2825similarly-detailed documentation for terminal emulators such as aixterm,
2826shelltool, dtterm.
2827
2828However long, the technical manuals have problems:
2829
2830o   DEC's manuals did not provide a comprehensive comparison of the
2831    features in different model.
2832
2833    Peter Sichel's Host Interface Functions Checklist spreadsheet is
2834    useful for noting which model introduced a given feature (although
2835    there are a few apparent errors such as the DECRQSS feature cited
2836    for VT320 whereas the technical manual omits it).
2837
2838o   Sometimes the manuals disagree.  For example, DEC's standard
2839    document (DEC STD 070) for terminals says that DECSCL performs a
2840    soft reset (DECSTR), while the VT420 manual says it does a hard
2841    reset (RIS).
2842
2843o   Sometimes the manuals are simply incorrect.  For example, testing a
2844    DEC VT420 in 1996 showed that the documented code for a valid or
2845    invalid response to DECRQSS was reversed.
2846
2847    The VT420 test results were incorporated into vttest program.  At
2848    the time, DEC STD 070 was not available, but it also agrees with
2849    vttest.  Later, documentation for the DEC VT525 was shown to have
2850    the same flaw.
2851
2852o   Not all details are clear even in DEC STD 070 (which is more than
2853    twice the length of the VT520 programmer's reference manual, and
2854    almost three times longer than the VT420 reference manual).
2855    However, as an internal standards document, DEC STD 070 is more
2856    likely to describe the actual behavior of DEC's terminals than the
2857    more polished user's guides.
2858
2859That said, here are technical manuals which have been used in developing
2860xterm.  Not all were available initially.  In August 1996 for instance,
2861the technical references were limited to EK-VT220-HR-002 and EK-
2862VT420-UG.002.  Shortly after, Richard Shuford sent a copy of EK-VT3XX-
2863TP-001.  Still later (beginning in 2003), Paul Williams' vt100.net site
2864provided EK-VT102-UG-003, EK-VT220-RM-002, EK-VT420-RM-002, EK-VT520-RM
2865A01, EK-VT100-TM-003, and EK-VT102-UG-003.  The remaining documents were
2866found on the bitsavers site.
2867
2868o   DECscope User's Manual.
2869    Digital Equipment Corporation (EK-VT5X-OP-001 1975).
2870
2871o   VT100 Series Video Terminal Technical Manual.
2872    Digital Equipment Corporation (EK-VT100-TM-003, July 1982).
2873
2874o   VT100 User Guide.
2875    Digital Equipment Corporation (EK-VT100-UG-003, June 1981).
2876
2877o   VT102 User Guide.
2878    Digital Equipment Corporation (EK-VT102-UG-003, February 1982).
2879
2880o   VT220 Programmer Pocket Guide.
2881    Digital Equipment Corporation (EK-VT220-HR-002, July 1984).
2882
2883o   VT220 Programmer Reference Manual.
2884    Digital Equipment Corporation (EK-VT220-RM-002, August 1984).
2885
2886o   VT240 Programmer Reference Manual.
2887    Digital Equipment Corporation (EK-VT240-RM-002, October 1984).
2888
2889o   VT330/VT340 Programmer Reference Manual
2890    Volume 1: Text Programming.
2891    Digital Equipment Corporation (EK-VT3XX-TP-001, March 1987).
2892
2893o   VT330/VT340 Programmer Reference Manual
2894    Volume 2: Graphics Programming.
2895    Digital Equipment Corporation (EK-VT3XX-GP-001, March 1987).
2896
2897o   Installing and Using
2898    The VT420 Video Terminal
2899    (North American Model).
2900    Digital Equipment Corporation (EK-VT420-UG.002, February 1990).
2901
2902o   VT420 Programmer Reference Manual.
2903    Digital Equipment Corporation (EK-VT420-RM-002, February 1992).
2904
2905o   VT510 Video Terminal
2906    Programmer Information.
2907    Digital Equipment Corporation (EK-VT510-RM B01, November 1993).
2908
2909o   VT520/VT525 Video Terminal
2910    Programmer Information.
2911    Digital Equipment Corporation (EK-VT520-RM A01, July 1994).
2912
2913o   Digital ANSI-Compliant Printing Protocol
2914    Level 2 Programming Reference Manual
2915    Digital Equipment Corporation (EK-PPLV2-PM B01, August 1994).
2916
2917o   4014 and 4014-1 Computer Display Terminal
2918    User's Manual.
2919    Tektronix, Inc.  (070-1647-00, November 1979).
2920
2921
2922Standards
2923
2924The DEC terminal family (VT100 through VT525) is upward-compatible,
2925using standards plus extensions, e.g., "private modes".  Not all
2926commonly-used features are standard.  For example, scrolling regions are
2927not found in ECMA-48.
2928
2929Again, it is possible to find discrepancies in the standards:
2930
2931o   The printed ECMA-48 5th edition (1991) and the first PDF produced
2932    for that edition (April 1998) state that SD (scroll down) ends with
2933    05/14, i.e., ^ , which disagrees with DEC's VT420 hardware
2934    implementation and DEC's manuals which use 05/04 T .  (A few other
2935    terminals such as AT&T 5620 and IBM 5151 also used 05/04, but the
2936    documentation and dates are lacking).
2937
2938    ECMA created a new PDF in April 2003 which changed that detail to
2939    use T , and later in 2008 provided PDFs of the earlier editions
2940    which used T .
2941
2942o   The VT320, VT420, VT520 manuals claim that DECSCL does a hard reset
2943    (RIS).
2944
2945    Both the VT220 manual and DEC STD 070 (which documents levels 1-4 in
2946    detail) state that it is a soft reset, e.g., DECSTR.
2947
2948Here are the relevant standards:
2949
2950o   ECMA-35: Character Code Structure and Extension Techniques
2951    (6th Edition, December 1994).
2952
2953o   ECMA-43: 8-bit Coded Character Set Structure and Rules
2954    (3rd Edition, December 1991).
2955
2956o   ECMA-48: Control Functions for Coded Character Sets
2957    (5th Edition, June 1991).
2958
2959o   DEC STD 070 Video Systems Reference Manual.
2960    Digital Equipment Corporation (A-MN-ELSM070-00-0000 Rev H, December
2961    3, 1991).
2962
2963
2964Miscellaneous
2965
2966A few hardware terminals survived into the 1990s only as terminal
2967emulators.  Documentation for these and other terminal emulators which
2968have influenced xterm are generally available only in less-accessible
2969and less-detailed manual pages.
2970
2971o   XTerm supports control sequences for manipulating its window which
2972    were implemented by Sun's shelltool program.  This was part of
2973    SunView (SunOS 3.0, 1986).  The change-notes for xterm's resize
2974    program in X10.4 (1986) mention its use of these "Sun tty emulation
2975    escape sequences" for resizing the window.  The X10.4 xterm program
2976    recognized these sequences for resizing the terminal, except for the
2977    iconify/deiconify pair.  SunView also introduced the SIGWINCH
2978    signal, used by the X10.4 xterm and mentioned in its CHANGES file:
2979
2980        The window size is passed to the operating system via TIOCSWINSZ
2981        (4.3) or TIOCSSIZE (sun).  A SIGWINCH signal is sent if the
2982        vtXXX window is resized.
2983
2984    While support for the Sun control-sequences remained in resize, the
2985    next release of xterm (X11R1 in 1987) omitted the code for
2986    interpreting them.
2987
2988    Later, the SunView program was adapted for the OPEN LOOK environment
2989    introduced 1988-1990.
2990
2991    Still later, in 1995, OPEN LOOK was abandoned in favor of CDE.  The
2992    CDE terminal emulator dtterm implemented those controls, with a
2993    couple of additions.
2994
2995    Starting in July 1996, xterm re-implemented those control sequences
2996    (based on the dtterm manual pages) and further extended the group of
2997    window controls.
2998
2999    There were two sets of controls (CSI Ps [ ; Pm ; Pm ] t , and OSC Ps
3000    text ST ) implemented by shelltool, documented in appendix E of both
3001    PHIGS Programming Manual (1992), and the unpublished X Window System
3002    User's Guide (OPEN LOOK Edition) (1995).  The CDE program kept
3003    those, and added a few new ones.
3004
3005    Code         Sun   CDE   XTerm   Description
3006    -----------------------------------------------------------------
3007    CSI 1 t      yes   yes    yes    de-iconify
3008    CSI 2 t      yes   yes    yes    iconify
3009    CSI 3 t      yes   yes    yes    move window to pixel-position
3010    CSI 4 t      yes   yes    yes    resize window in pixels
3011    CSI 5 t      yes   yes    yes    raise window to front of stack
3012    CSI 6 t      yes   yes    yes    raise window to back of stack
3013    CSI 7 t      yes   yes    yes    refresh window
3014    CSI 8 t      yes   yes    yes    resize window in chars
3015    CSI 9 t       -     -     yes    maximize/unmaximize window
3016    CSI 1 0 t     -     -     yes    to/from full-screen
3017    CSI 1 1 t    yes   yes    yes    report if window is iconified
3018    CSI 1 2 t     -     -      -     -
3019    CSI 1 3 t    yes   yes    yes    report window position
3020    CSI 1 4 t    yes   yes    yes    report window size in pixels
3021    CSI 1 5 t     -     -     yes    report screen size in pixels
3022    CSI 1 6 t     -     -     yes    report character cell in pixels
3023    CSI 1 7 t     -     -      -     -
3024    CSI 1 8 t    yes   yes    yes    report window size in chars
3025    CSI 1 9 t     -     -     yes    report screen size in chars
3026    CSI 2 0 t     -    yes    yes    report icon label
3027    CSI 2 1 t     -    yes    yes    report window title
3028    CSI 2 2 t     -     -     yes    save window/icon title
3029    CSI 2 3 t     -     -     yes    restore window/icon title
3030    CSI 2 4 t     -     -     yes    resize window (DECSLPP)
3031    OSC 0 ST      -    yes    yes    set window and icon title
3032    OSC 1 ST      -    yes    yes    set icon label
3033    OSC 2 ST      -    yes    yes    set window title
3034    OSC 3 ST      -    n/a    yes    set X server property
3035    OSC I ST     yes   yes    yes    set icon to file
3036    OSC l ST     yes   yes    yes    set window title
3037    OSC L ST     yes   yes    yes    set icon label
3038
3039    Besides the Sun-derived OSC controls for setting window title and
3040    icon label, dtterm also supported the xterm controls for the same
3041    feature.
3042
3043    The CDE source was unavailable for inspection until 2012, so that
3044    clarification of the details of the window operations relied upon
3045    vttest.
3046
3047o   The control sequences for saving/restoring the cursor and for
3048    saving/restoring "DEC Private Mode Values" may appear to be related
3049    (since the "save" controls both end with s ), but that is
3050    coincidental.  The latter was introduced in X10.4:
3051
3052        Most Dec Private mode settings can be saved away internally
3053        using \E[?ns, where n is the same number to set or reset the Dec
3054        Private mode.  The mode can be restored using \E[?nr.  This can
3055        be used in termcap for vi, for example, to turn off saving of
3056        lines, but restore whatever the original state was on exit.
3057
3058    while the SCOSC/SCORC  pair  was  added  in  1995  by  XFree86  (and
3059    documented long afterwards).
3060
3061o   The aixterm manual page gives the format of the control sequence for
3062    foreground and background colors 8-15, but  does  not  specify  what
3063    those  colors  are.  That is implied by the description's mention of
3064    HFT:
3065
3066        The aixterm command provides a standard terminal type for
3067        programs that do not interact directly with Enhanced X-Windows.
3068        This command provides an emulation for a VT102 terminal or a
3069        high function terminal (HFT).  The VT102 mode is activated by
3070        the -v flag.
3071
3072    Unlike xterm, there are no resource names for the 16 colors, leaving
3073    the  reader  to  assume that the mapping is hard-coded.  The control
3074    sequences for colors 8-15 are not specified by ECMA-48,  but  rather
3075    (as  done  in  other instances by xterm) chosen to not conflict with
3076    current or future standards.
3077