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