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