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