ctlseqs.txt revision 913cc679
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-2017)
24               updated for XTerm Patch #329 (2017/06/11)
25
26
27
28Definitions
29
30c    The literal character c.
31
32C    A single (required) character.
33
34Ps   A single (usually optional) numeric parameter, composed of one of
35     more digits.
36
37Pm   A multiple numeric parameter composed of any number of single
38     numeric parameters, separated by ;  character(s).  Individual val-
39     ues for the parameters are listed with Ps .
40
41Pt   A text parameter composed of printable characters.
42
43Control Bytes, Characters, and Sequences
44
45ECMA-48 (aka "ISO 6429") documents C1 (8-bit) and C0 (7-bit) codes.
46Those are respectively codes 128 to 159 and 0 to 31.  ECMA-48 avoids
47referring to these codes as characters, because that term is associated
48with graphic characters.  Instead, it uses "bytes" and "codes", with
49occasional lapses to "characters" where the meaning cannot be mistaken.
50
51Controls (including the escape code 27) are processed once:
52
53o This means that a C1 control can be mistaken for badly-formed UTF-8
54  when the terminal runs in UTF-8 mode because C1 controls are valid
55  continuation bytes of a UTF-8 encoded (multibyte) value.
56
57o It is not possible to use a C1 control obtained from decoding the
58  UTF-8 text, because that would require reprocessing the data.  Conse-
59  quently there is no ambiguity in the way this document uses the term
60  "character" to refer to bytes in a control sequence.
61
62The order of processing is a necessary consequence of the way ECMA-48 is
63designed:
64
65o Each byte sent to the terminal can be unambiguously determined to fall
66  into one of a few categories (C0, C1 and graphic characters).
67
68o ECMA-48 is modal; once it starts processing a control sequence, the
69  terminal continues until the sequence is complete, or some byte is
70  found which is not allowed in the sequence.
71
72o Intermediate, parameter and final bytes may use the same codes as
73  graphic characters, but they are processed as part of a control
74  sequence and are not actually graphic characters.
75
76o Eight-bit controls can have intermediate, etc., bytes in the range 160
77  to 255.  Those can be treated as their counterparts in the range 32 to
78  127.
79
80o Single-byte controls can be handled separately from multi-byte control
81  sequences because ECMA-48's rules are unambiguous.
82
83  As a special case, ECMA-48 (section 9) mentions that the control func-
84  tions shift-in and shift-out are allowed to occur within a 7-bit
85  multibyte control sequence because those cannot alter the meaning of
86  the control sequence.
87
88o Some controls (such as OSC ) introduce a string mode, which is ended
89  on a ST  (string terminator).
90
91  Again, the terminal should accept single-byte controls within the
92  string.  However, xterm has a resource setting brokenLinuxOSC to allow
93  recovery from applications which rely upon malformed palette sequences
94  used by the Linux console.
95
96C1 (8-Bit) Control Characters
97
98The xterm program recognizes both 8-bit and 7-bit control characters.
99It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled.
100The following pairs of 7-bit and 8-bit control characters are equiva-
101lent:
102
103ESC D
104     Index (IND  is 0x84).
105ESC E
106     Next Line (NEL  is 0x85).
107ESC H
108     Tab Set (HTS  is 0x88).
109ESC M
110     Reverse Index (RI  is 0x8d).
111ESC N
112     Single Shift Select of G2 Character Set (SS2  is 0x8e).  This
113     affects next character only.
114ESC O
115     Single Shift Select of G3 Character Set (SS3  is 0x8f).  This
116     affects next character only.
117ESC P
118     Device Control String (DCS  is 0x90).
119ESC V
120     Start of Guarded Area (SPA  is 0x96).
121ESC W
122     End of Guarded Area (EPA  is 0x97).
123ESC X
124     Start of String (SOS  is 0x98).
125ESC Z
126     Return Terminal ID (DECID is 0x9a).  Obsolete form of CSI c  (DA).
127ESC [
128     Control Sequence Introducer (CSI  is 0x9b).
129ESC \
130     String Terminator (ST  is 0x9c).
131ESC ]
132     Operating System Command (OSC  is 0x9d).
133ESC ^
134     Privacy Message (PM  is 0x9e).
135ESC _
136     Application Program Command (APC  is 0x9f).
137
138These control characters are used in the vtXXX emulation.
139
140VT100 Mode
141Most of these control sequences are standard VT102 control sequences,
142but there is support for later DEC VT terminals (i.e., VT220, VT320,
143VT420, VT510), as well as ISO 6429 and aixterm color controls.  The only
144VT102 feature not supported is auto-repeat, since the only way X pro-
145vides for this will affect all windows.
146There are additional control sequences to provide xterm-dependent func-
147tions, such as the scrollbar or window size.  Where the function is
148specified by DEC or ISO 6429, the code assigned to it is given in paren-
149theses.
150The escape codes to designate and invoke character sets are specified by
151ISO 2022 (see that document for a discussion of character sets).
152Many of the features are optional; xterm can be configured and built
153without support for them.
154
155Single-character functions
156BEL       Bell (Ctrl-G).
157BS        Backspace (Ctrl-H).
158CR        Carriage Return (Ctrl-M).
159ENQ       Return Terminal Status (Ctrl-E).  Default response is an empty
160          string, but may be overridden by a resource answerbackString.
161FF        Form Feed or New Page (NP).  (FF  is Ctrl-L).  FF  is treated
162          the same as LF .
163LF        Line Feed or New Line (NL).  (LF  is Ctrl-J).
164SI        Shift In (Ctrl-O) -> Switch to Standard Character Set.  This
165          invokes the G0 character set (the default).
166SO        Shift Out (Ctrl-N) -> Switch to Alternate Character Set.  This
167          invokes the G1 character set.
168SP        Space.
169TAB       Horizontal Tab (HT) (Ctrl-I).
170VT        Vertical Tab (Ctrl-K).  This is treated the same as LF.
171
172Controls beginning with ESC
173This excludes controls where ESC  is part of a 7-bit equivalent to 8-bit
174C1 controls, ordered by the final character(s).
175ESC SP F  7-bit controls (S7C1T).
176ESC SP G  8-bit controls (S8C1T).
177ESC SP L  Set ANSI conformance level 1 (dpANS X3.134.1).
178ESC SP M  Set ANSI conformance level 2 (dpANS X3.134.1).
179ESC SP N  Set ANSI conformance level 3 (dpANS X3.134.1).
180ESC # 3   DEC double-height line, top half (DECDHL).
181ESC # 4   DEC double-height line, bottom half (DECDHL).
182ESC # 5   DEC single-width line (DECSWL).
183ESC # 6   DEC double-width line (DECDWL).
184ESC # 8   DEC Screen Alignment Test (DECALN).
185ESC % @   Select default character set.  That is ISO 8859-1 (ISO 2022).
186ESC % G   Select UTF-8 character set (ISO 2022).
187ESC ( C   Designate G0 Character Set (ISO 2022, VT100).
188          Final character C for designating 94-character sets.  In this
189          list, 0 , A  and B  apply to VT100 and up, the remainder to
190          VT220 and up.  The VT220 character sets, together with the
191          Portuguese character set are activated by the National
192          Replacement Character controls.  The A  is a special case,
193          since it is also activated by the VT300-control for British
194          Latin-1 separately from the National Replacement Character
195          controls.
196            C = 0  -> DEC Special Character and Line Drawing Set.
197            C = <  -> DEC Supplementary (VT200).
198            C = % 5  -> DEC Supplementary Graphics (VT300).
199            C = >  -> DEC Technical (VT300).
200            C = A  -> United Kingdom (UK).
201            C = B  -> United States (USASCII).
202            C = 4  -> Dutch.
203            C = C  or 5  -> Finnish.
204            C = R  or f  -> French.
205            C = Q  or 9  -> French Canadian (VT200, VT300).
206            C = K  -> German.
207            C = Y  -> Italian.
208            C = ` , E  or 6  -> Norwegian/Danish.
209            C = % 6  -> Portuguese (VT300).
210            C = Z  -> Spanish.
211            C = H  or 7  -> Swedish.
212            C = =  -> Swiss.
213ESC ) C   Designate G1 Character Set (ISO 2022, VT100).
214          The same character sets apply as for ESC ( C.
215ESC * C   Designate G2 Character Set (ISO 2022, VT220).
216          The same character sets apply as for ESC ( C.
217ESC + C   Designate G3 Character Set (ISO 2022, VT220).
218          The same character sets apply as for ESC ( C.
219ESC - C   Designate G1 Character Set (VT300).
220          The same character sets apply as for ESC ( C.
221ESC . C   Designate G2 Character Set (VT300).
222          The same character sets apply as for ESC ( C.
223ESC / C   Designate G3 Character Set (VT300).
224          These work for 96-character sets only.
225            C = A  -> ISO Latin-1 Supplemental.
226ESC 6     Back Index (DECBI), VT420 and up.
227ESC 7     Save Cursor (DECSC).
228ESC 8     Restore Cursor (DECRC).
229ESC 9     Forward Index (DECFI), VT420 and up.
230ESC =     Application Keypad (DECKPAM).
231ESC >     Normal Keypad (DECKPNM).
232ESC F     Cursor to lower left corner of screen.  This is enabled by the
233          hpLowerleftBugCompat resource.
234ESC c     Full Reset (RIS).
235ESC l     Memory Lock (per HP terminals).  Locks memory above the cur-
236          sor.
237ESC m     Memory Unlock (per HP terminals).
238ESC n     Invoke the G2 Character Set as GL (LS2).
239ESC o     Invoke the G3 Character Set as GL (LS3).
240ESC |     Invoke the G3 Character Set as GR (LS3R).
241ESC }     Invoke the G2 Character Set as GR (LS2R).
242ESC ~     Invoke the G1 Character Set as GR (LS1R).
243
244Application Program-Command functions
245APC Pt ST None.  xterm implements no APC  functions; Pt is ignored.  Pt
246          need not be printable characters.
247
248Device-Control functions
249DCS Ps; Ps| Pt ST
250          User-Defined Keys (DECUDK).  The first parameter:
251            Ps = 0  -> Clear all UDK definitions before starting
252          (default).
253            Ps = 1  -> Erase Below (default).
254          The second parameter:
255            Ps = 0  <- Lock the keys (default).
256            Ps = 1  <- Do not lock.
257          The third parameter is a ';'-separated list of strings denot-
258          ing the key-code separated by a '/' from the hex-encoded key
259          value.  The key codes correspond to the DEC function-key codes
260          (e.g., F6=17).
261DCS $ q Pt ST
262          Request Status String (DECRQSS).  The string following the "q"
263          is one of the following:
264            " q     -> DECSCA
265            " p     -> DECSCL
266            r       -> DECSTBM
267            s       -> DECSLRM
268            m       -> SGR
269            SP q    -> DECSCUSR
270          xterm responds with DCS 1 $ r Pt ST for valid requests,
271          replacing the Pt with the corresponding CSI string, or DCS 0 $
272          r Pt ST for invalid requests.
273DCS + p Pt ST
274          Set Termcap/Terminfo Data (xterm, experimental).  The string
275          following the "p" is a name to use for retrieving data from
276          the terminal database.  The data will be used for the "tcap"
277          keyboard configuration's function- and special-keys, as well
278          as by the Request Termcap/Terminfo String control.
279DCS + q Pt ST
280          Request Termcap/Terminfo String (xterm, experimental).  The
281          string following the "q" is a list of names encoded in hexa-
282          decimal (2 digits per character) separated by ; which corre-
283          spond to termcap or terminfo key names.
284          Two special features are also recognized, which are not key
285          names: Co for termcap colors (or colors for terminfo colors),
286          and TN for termcap name (or name for terminfo name).
287          xterm responds with DCS 1 + r Pt ST for valid requests, adding
288          to Pt an = , and the value of the corresponding string that
289          xterm would send, or DCS 0 + r Pt ST for invalid requests.
290          The strings are encoded in hexadecimal (2 digits per charac-
291          ter).
292
293Functions using CSI , ordered by the final character(s)
294CSI Ps @  Insert Ps (Blank) Character(s) (default = 1) (ICH).
295CSI Ps A  Cursor Up Ps Times (default = 1) (CUU).
296CSI Ps B  Cursor Down Ps Times (default = 1) (CUD).
297CSI Ps C  Cursor Forward Ps Times (default = 1) (CUF).
298CSI Ps D  Cursor Backward Ps Times (default = 1) (CUB).
299CSI Ps E  Cursor Next Line Ps Times (default = 1) (CNL).
300CSI Ps F  Cursor Preceding Line Ps Times (default = 1) (CPL).
301CSI Ps G  Cursor Character Absolute  [column] (default = [row,1]) (CHA).
302CSI Ps ; Ps H
303          Cursor Position [row;column] (default = [1,1]) (CUP).
304CSI Ps I  Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
305CSI Ps J  Erase in Display (ED).
306            Ps = 0  -> Erase Below (default).
307            Ps = 1  -> Erase Above.
308            Ps = 2  -> Erase All.
309            Ps = 3  -> Erase Saved Lines (xterm).
310CSI ? Ps J
311          Erase in Display (DECSED).
312            Ps = 0  -> Selective Erase Below (default).
313            Ps = 1  -> Selective Erase Above.
314            Ps = 2  -> Selective Erase All.
315            Ps = 3  -> Selective Erase Saved Lines (xterm).
316CSI Ps K  Erase in Line (EL).
317            Ps = 0  -> Erase to Right (default).
318            Ps = 1  -> Erase to Left.
319            Ps = 2  -> Erase All.
320CSI ? Ps K
321          Erase in Line (DECSEL).
322            Ps = 0  -> Selective Erase to Right (default).
323            Ps = 1  -> Selective Erase to Left.
324            Ps = 2  -> Selective Erase All.
325CSI Ps L  Insert Ps Line(s) (default = 1) (IL).
326CSI Ps M  Delete Ps Line(s) (default = 1) (DL).
327CSI Ps P  Delete Ps Character(s) (default = 1) (DCH).
328CSI Ps S  Scroll up Ps lines (default = 1) (SU).
329CSI ? Pi; Pa; Pv S
330          If configured to support either Sixel Graphics or ReGIS Graph-
331          ics, xterm accepts a three-parameter control sequence, where
332          Pi, Pa and Pv are the item, action and value:
333
334            Pi = 1  -> item is number of color registers.
335            Pi = 2  -> item is Sixel graphics geometry (in pixels).
336            Pi = 3  -> item is ReGIS graphics geometry (in pixels).
337
338            Pa = 1  -> read
339            Pa = 2  -> reset to default
340            Pa = 3  -> set to value in Pv
341            Pa = 4  -> read the maximum allowed value
342
343            Pv can be omitted except when setting (Pa == 3 ).
344            Pv = n <- A single integer is used for color registers.
345            Pv = width; height <- Two integers for graphics geometry.
346
347          xterm replies with a control sequence of the same form:
348
349               CSI ? Pi; Ps; Pv S
350
351          where Ps is the status:
352            Ps = 0  -> success.
353            Ps = 1  -> error in Pi.
354            Ps = 2  -> error in Pa.
355            Ps = 3  -> failure.
356
357          On success, Pv represents the value read or set.
358
359          Notes:
360          o The current implementation allows reading the graphics
361            sizes, but disallows modifying those sizes because that is
362            done once, using resource-values.
363          o Graphics geometry is not necessarily the same as "window
364            size" (see the dtterm window manipulation extensions). For
365            example, xterm limits the maximum graphics geometry at com-
366            pile time (1000x1000 as of version 328) although the window
367            size can be larger.
368          o While resizing a window will always change the current
369            graphics geometry, the reverse is not true.  Setting graph-
370            ics geometry does not affect the window size.
371CSI Ps T  Scroll down Ps lines (default = 1) (SD).
372CSI Ps ; Ps ; Ps ; Ps ; Ps T
373          Initiate highlight mouse tracking.  Parameters are
374          [func;startx;starty;firstrow;lastrow].  See the section Mouse
375          Tracking.
376CSI > Ps; Ps T
377          Reset one or more features of the title modes to the default
378          value.  Normally, "reset" disables the feature.  It is possi-
379          ble to disable the ability to reset features by compiling a
380          different default for the title modes into xterm.
381            Ps = 0  -> Do not set window/icon labels using hexadecimal.
382            Ps = 1  -> Do not query window/icon labels using hexadeci-
383          mal.
384            Ps = 2  -> Do not set window/icon labels using UTF-8.
385            Ps = 3  -> Do not query window/icon labels using UTF-8.
386          (See discussion of "Title Modes").
387CSI Ps X  Erase Ps Character(s) (default = 1) (ECH).
388CSI Ps Z  Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
389CSI Pm `  Character Position Absolute  [column] (default = [row,1])
390          (HPA).
391CSI Pm a  Character Position Relative  [columns] (default = [row,col+1])
392          (HPR).
393CSI Ps b  Repeat the preceding graphic character Ps times (REP).
394CSI Ps c  Send Device Attributes (Primary DA).
395            Ps = 0  or omitted -> request attributes from terminal.  The
396          response depends on the decTerminalID resource setting.
397            -> CSI ? 1 ; 2 c  ("VT100 with Advanced Video Option")
398            -> CSI ? 1 ; 0 c  ("VT101 with No Options")
399            -> CSI ? 6 c  ("VT102")
400            -> CSI ? 6 2 ; Psc  ("VT220")
401            -> CSI ? 6 3 ; Psc  ("VT320")
402            -> CSI ? 6 4 ; Psc  ("VT420")
403          The VT100-style response parameters do not mean anything by
404          themselves.  VT220 (and higher) parameters do, telling the
405          host what features the terminal supports:
406            Ps = 1  -> 132-columns.
407            Ps = 2  -> Printer.
408            Ps = 3  -> ReGIS graphics.
409            Ps = 4  -> Sixel graphics.
410            Ps = 6  -> Selective erase.
411            Ps = 8  -> User-defined keys.
412            Ps = 9  -> National Replacement Character sets.
413            Ps = 1 5  -> Technical characters.
414            Ps = 1 8  -> User windows.
415            Ps = 2 1  -> Horizontal scrolling.
416            Ps = 2 2  -> ANSI color, e.g., VT525.
417            Ps = 2 9  -> ANSI text locator (i.e., DEC Locator mode).
418CSI > Ps c
419          Send Device Attributes (Secondary DA).
420            Ps = 0  or omitted -> request the terminal's identification
421          code.  The response depends on the decTerminalID resource set-
422          ting.  It should apply only to VT220 and up, but xterm extends
423          this to VT100.
424            -> CSI  > Pp ; Pv ; Pc c
425          where Pp denotes the terminal type
426            Pp = 0  -> "VT100".
427            Pp = 1  -> "VT220".
428            Pp = 2  -> "VT240".
429            Pp = 1 8 -> "VT330".
430            Pp = 1 9 -> "VT340".
431            Pp = 2 4 -> "VT320".
432            Pp = 4 1 -> "VT420".
433            Pp = 6 1 -> "VT510".
434            Pp = 6 4 -> "VT520".
435            Pp = 6 5 -> "VT525".
436          and Pv is the firmware version (for xterm, this was originally
437          the XFree86 patch number, starting with 95).  In a DEC termi-
438          nal, Pc indicates the ROM cartridge registration number and is
439          always zero.
440CSI Pm d  Line Position Absolute  [row] (default = [1,column]) (VPA).
441CSI Pm e  Line Position Relative  [rows] (default = [row+1,column])
442          (VPR).
443CSI Ps ; Ps f
444          Horizontal and Vertical Position [row;column] (default =
445          [1,1]) (HVP).
446CSI Ps g  Tab Clear (TBC).
447            Ps = 0  -> Clear Current Column (default).
448            Ps = 3  -> Clear All.
449CSI Pm h  Set Mode (SM).
450            Ps = 2  -> Keyboard Action Mode (AM).
451            Ps = 4  -> Insert Mode (IRM).
452            Ps = 1 2  -> Send/receive (SRM).
453            Ps = 2 0  -> Automatic Newline (LNM).
454CSI ? Pm h
455          DEC Private Mode Set (DECSET).
456            Ps = 1  -> Application Cursor Keys (DECCKM).
457            Ps = 2  -> Designate USASCII for character sets G0-G3
458          (DECANM), and set VT100 mode.
459            Ps = 3  -> 132 Column Mode (DECCOLM).
460            Ps = 4  -> Smooth (Slow) Scroll (DECSCLM).
461            Ps = 5  -> Reverse Video (DECSCNM).
462            Ps = 6  -> Origin Mode (DECOM).
463            Ps = 7  -> Wraparound Mode (DECAWM).
464            Ps = 8  -> Auto-repeat Keys (DECARM).
465            Ps = 9  -> Send Mouse X & Y on button press.  See the sec-
466          tion Mouse Tracking.  This is the X10 xterm mouse protocol.
467            Ps = 1 0  -> Show toolbar (rxvt).
468            Ps = 1 2  -> Start Blinking Cursor (att610).
469            Ps = 1 8  -> Print form feed (DECPFF).
470            Ps = 1 9  -> Set print extent to full screen (DECPEX).
471            Ps = 2 5  -> Show Cursor (DECTCEM).
472            Ps = 3 0  -> Show scrollbar (rxvt).
473            Ps = 3 5  -> Enable font-shifting functions (rxvt).
474            Ps = 3 8  -> Enter Tektronix Mode (DECTEK).
475            Ps = 4 0  -> Allow 80 -> 132 Mode.
476            Ps = 4 1  -> more(1) fix (see curses resource).
477            Ps = 4 2  -> Enable National Replacement Character sets
478          (DECNRCM).
479            Ps = 4 4  -> Turn On Margin Bell.
480            Ps = 4 5  -> Reverse-wraparound Mode.
481            Ps = 4 6  -> Start Logging.  This is normally disabled by a
482          compile-time option.
483            Ps = 4 7  -> Use Alternate Screen Buffer.  (This may be dis-
484          abled by the titeInhibit resource).
485            Ps = 6 6  -> Application keypad (DECNKM).
486            Ps = 6 7  -> Backarrow key sends backspace (DECBKM).
487            Ps = 6 9  -> Enable left and right margin mode (DECLRMM),
488          VT420 and up.
489            Ps = 9 5  -> Do not clear screen when DECCOLM is set/reset
490          (DECNCSM), VT510 and up.
491            Ps = 1 0 0 0  -> Send Mouse X & Y on button press and
492          release.  See the section Mouse Tracking.  This is the X11
493          xterm mouse protocol.
494            Ps = 1 0 0 1  -> Use Hilite Mouse Tracking.
495            Ps = 1 0 0 2  -> Use Cell Motion Mouse Tracking.
496            Ps = 1 0 0 3  -> Use All Motion Mouse Tracking.
497            Ps = 1 0 0 4  -> Send FocusIn/FocusOut events.
498            Ps = 1 0 0 5  -> Enable UTF-8 Mouse Mode.
499            Ps = 1 0 0 6  -> Enable SGR Mouse Mode.
500            Ps = 1 0 0 7  -> Enable Alternate Scroll Mode, i.e., the
501          alternateScroll resource.
502            Ps = 1 0 1 0  -> Scroll to bottom on tty output (rxvt).
503            Ps = 1 0 1 1  -> Scroll to bottom on key press (rxvt).
504            Ps = 1 0 1 5  -> Enable urxvt Mouse Mode.
505            Ps = 1 0 3 4  -> Interpret "meta" key, sets eighth bit.
506          (enables the eightBitInput resource).
507            Ps = 1 0 3 5  -> Enable special modifiers for Alt and Num-
508          Lock keys.  (This enables the numLock resource).
509            Ps = 1 0 3 6  -> Send ESC   when Meta modifies a key.  (This
510          enables the metaSendsEscape resource).
511            Ps = 1 0 3 7  -> Send DEL from the editing-keypad Delete
512          key.
513            Ps = 1 0 3 9  -> Send ESC  when Alt modifies a key.  (This
514          enables the altSendsEscape resource).
515            Ps = 1 0 4 0  -> Keep selection even if not highlighted.
516          (This enables the keepSelection resource).
517            Ps = 1 0 4 1  -> Use the CLIPBOARD selection.  (This enables
518          the selectToClipboard resource).
519            Ps = 1 0 4 2  -> Enable Urgency window manager hint when
520          Control-G is received.  (This enables the bellIsUrgent
521          resource).
522            Ps = 1 0 4 3  -> Enable raising of the window when Control-G
523          is received.  (enables the popOnBell resource).
524            Ps = 1 0 4 4  -> Reuse the most recent data copied to CLIP-
525          BOARD.  (This enables the keepClipboard resource).
526            Ps = 1 0 4 7  -> Use Alternate Screen Buffer.  (This may be
527          disabled by the titeInhibit resource).
528            Ps = 1 0 4 8  -> Save cursor as in DECSC.  (This may be dis-
529          abled by the titeInhibit resource).
530            Ps = 1 0 4 9  -> Save cursor as in DECSC and use Alternate
531          Screen Buffer, clearing it first.  (This may be disabled by
532          the titeInhibit resource).  This combines the effects of the 1
533          0 4 7  and 1 0 4 8  modes.  Use this with terminfo-based
534          applications rather than the 4 7  mode.
535            Ps = 1 0 5 0  -> Set terminfo/termcap function-key mode.
536            Ps = 1 0 5 1  -> Set Sun function-key mode.
537            Ps = 1 0 5 2  -> Set HP function-key mode.
538            Ps = 1 0 5 3  -> Set SCO function-key mode.
539            Ps = 1 0 6 0  -> Set legacy keyboard emulation (X11R6).
540            Ps = 1 0 6 1  -> Set VT220 keyboard emulation.
541            Ps = 2 0 0 4  -> Set bracketed paste mode.
542CSI Pm i  Media Copy (MC).
543            Ps = 0  -> Print screen (default).
544            Ps = 4  -> Turn off printer controller mode.
545            Ps = 5  -> Turn on printer controller mode.
546            Ps = 1  0  -> HTML screen dump.
547            Ps = 1  1  -> SVG screen dump.
548CSI ? Pm i
549          Media Copy (MC, DEC-specific).
550            Ps = 1  -> Print line containing cursor.
551            Ps = 4  -> Turn off autoprint mode.
552            Ps = 5  -> Turn on autoprint mode.
553            Ps = 1  0  -> Print composed display, ignores DECPEX.
554            Ps = 1  1  -> Print all pages.
555CSI Pm l  Reset Mode (RM).
556            Ps = 2  -> Keyboard Action Mode (AM).
557            Ps = 4  -> Replace Mode (IRM).
558            Ps = 1 2  -> Send/receive (SRM).
559            Ps = 2 0  -> Normal Linefeed (LNM).
560CSI ? Pm l
561          DEC Private Mode Reset (DECRST).
562            Ps = 1  -> Normal Cursor Keys (DECCKM).
563            Ps = 2  -> Designate VT52 mode (DECANM).
564            Ps = 3  -> 80 Column Mode (DECCOLM).
565            Ps = 4  -> Jump (Fast) Scroll (DECSCLM).
566            Ps = 5  -> Normal Video (DECSCNM).
567            Ps = 6  -> Normal Cursor Mode (DECOM).
568            Ps = 7  -> No Wraparound Mode (DECAWM).
569            Ps = 8  -> No Auto-repeat Keys (DECARM).
570            Ps = 9  -> Don't send Mouse X & Y on button press.
571            Ps = 1 0  -> Hide toolbar (rxvt).
572            Ps = 1 2  -> Stop Blinking Cursor (att610).
573            Ps = 1 8  -> Don't print form feed (DECPFF).
574            Ps = 1 9  -> Limit print to scrolling region (DECPEX).
575            Ps = 2 5  -> Hide Cursor (DECTCEM).
576            Ps = 3 0  -> Don't show scrollbar (rxvt).
577            Ps = 3 5  -> Disable font-shifting functions (rxvt).
578            Ps = 4 0  -> Disallow 80 -> 132 Mode.
579            Ps = 4 1  -> No more(1) fix (see curses resource).
580            Ps = 4 2  -> Disable National Replacement Character sets
581          (DECNRCM).
582            Ps = 4 4  -> Turn Off Margin Bell.
583            Ps = 4 5  -> No Reverse-wraparound Mode.
584            Ps = 4 6  -> Stop Logging.  (This is normally disabled by a
585          compile-time option).
586            Ps = 4 7  -> Use Normal Screen Buffer.
587            Ps = 6 6  -> Numeric keypad (DECNKM).
588            Ps = 6 7  -> Backarrow key sends delete (DECBKM).
589            Ps = 6 9  -> Disable left and right margin mode (DECLRMM),
590          VT420 and up.
591            Ps = 9 5  -> Clear screen when DECCOLM is set/reset (DEC-
592          NCSM), VT510 and up.
593            Ps = 1 0 0 0  -> Don't send Mouse X & Y on button press and
594          release.  See the section Mouse Tracking.
595            Ps = 1 0 0 1  -> Don't use Hilite Mouse Tracking.
596            Ps = 1 0 0 2  -> Don't use Cell Motion Mouse Tracking.
597            Ps = 1 0 0 3  -> Don't use All Motion Mouse Tracking.
598            Ps = 1 0 0 4  -> Don't send FocusIn/FocusOut events.
599            Ps = 1 0 0 5  -> Disable UTF-8 Mouse Mode.
600            Ps = 1 0 0 6  -> Disable SGR Mouse Mode.
601            Ps = 1 0 0 7  -> Disable Alternate Scroll Mode, i.e., the
602          alternateScroll resource.
603            Ps = 1 0 1 0  -> Don't scroll to bottom on tty output
604          (rxvt).
605            Ps = 1 0 1 1  -> Don't scroll to bottom on key press (rxvt).
606            Ps = 1 0 1 5  -> Disable urxvt Mouse Mode.
607            Ps = 1 0 3 4  -> Don't interpret "meta" key.  (This disables
608          the eightBitInput resource).
609            Ps = 1 0 3 5  -> Disable special modifiers for Alt and Num-
610          Lock keys.  (This disables the numLock resource).
611            Ps = 1 0 3 6  -> Don't send ESC  when Meta modifies a key.
612          (This disables the metaSendsEscape resource).
613            Ps = 1 0 3 7  -> Send VT220 Remove from the editing-keypad
614          Delete key.
615            Ps = 1 0 3 9  -> Don't send ESC  when Alt modifies a key.
616          (This disables the altSendsEscape resource).
617            Ps = 1 0 4 0  -> Do not keep selection when not highlighted.
618          (This disables the keepSelection resource).
619            Ps = 1 0 4 1  -> Use the PRIMARY selection.  (This disables
620          the selectToClipboard resource).
621            Ps = 1 0 4 2  -> Disable Urgency window manager hint when
622          Control-G is received.  (This disables the bellIsUrgent
623          resource).
624            Ps = 1 0 4 3  -> Disable raising of the window when Control-
625          G is received.  (This disables the popOnBell resource).
626            Ps = 1 0 4 7  -> Use Normal Screen Buffer, clearing screen
627          first if in the Alternate Screen.  (This may be disabled by
628          the titeInhibit resource).
629            Ps = 1 0 4 8  -> Restore cursor as in DECRC.  (This may be
630          disabled by the titeInhibit resource).
631            Ps = 1 0 4 9  -> Use Normal Screen Buffer and restore cursor
632          as in DECRC.  (This may be disabled by the titeInhibit
633          resource).  This combines the effects of the 1 0 4 7  and 1 0
634          4 8  modes.  Use this with terminfo-based applications rather
635          than the 4 7  mode.
636            Ps = 1 0 5 0  -> Reset terminfo/termcap function-key mode.
637            Ps = 1 0 5 1  -> Reset Sun function-key mode.
638            Ps = 1 0 5 2  -> Reset HP function-key mode.
639            Ps = 1 0 5 3  -> Reset SCO function-key mode.
640            Ps = 1 0 6 0  -> Reset legacy keyboard emulation (X11R6).
641            Ps = 1 0 6 1  -> Reset keyboard emulation to Sun/PC style.
642            Ps = 2 0 0 4  -> Reset bracketed paste mode.
643CSI Pm m  Character Attributes (SGR).
644            Ps = 0  -> Normal (default).
645            Ps = 1  -> Bold.
646            Ps = 2  -> Faint, decreased intensity (ISO 6429).
647            Ps = 3  -> Italicized (ISO 6429).
648            Ps = 4  -> Underlined.
649            Ps = 5  -> Blink (appears as Bold).
650            Ps = 7  -> Inverse.
651            Ps = 8  -> Invisible, i.e., hidden (VT300).
652            Ps = 9  -> Crossed-out characters (ISO 6429).
653            Ps = 2 1  -> Doubly-underlined (ISO 6429).
654            Ps = 2 2  -> Normal (neither bold nor faint).
655            Ps = 2 3  -> Not italicized (ISO 6429).
656            Ps = 2 4  -> Not underlined.
657            Ps = 2 5  -> Steady (not blinking).
658            Ps = 2 7  -> Positive (not inverse).
659            Ps = 2 8  -> Visible, i.e., not hidden (VT300).
660            Ps = 2 9  -> Not crossed-out (ISO 6429).
661            Ps = 3 0  -> Set foreground color to Black.
662            Ps = 3 1  -> Set foreground color to Red.
663            Ps = 3 2  -> Set foreground color to Green.
664            Ps = 3 3  -> Set foreground color to Yellow.
665            Ps = 3 4  -> Set foreground color to Blue.
666            Ps = 3 5  -> Set foreground color to Magenta.
667            Ps = 3 6  -> Set foreground color to Cyan.
668            Ps = 3 7  -> Set foreground color to White.
669            Ps = 3 9  -> Set foreground color to default (original).
670            Ps = 4 0  -> Set background color to Black.
671            Ps = 4 1  -> Set background color to Red.
672            Ps = 4 2  -> Set background color to Green.
673            Ps = 4 3  -> Set background color to Yellow.
674            Ps = 4 4  -> Set background color to Blue.
675            Ps = 4 5  -> Set background color to Magenta.
676            Ps = 4 6  -> Set background color to Cyan.
677            Ps = 4 7  -> Set background color to White.
678            Ps = 4 9  -> Set background color to default (original).
679
680          If 16-color support is compiled, the following apply.  Assume
681          that xterm's resources are set so that the ISO color codes are
682          the first 8 of a set of 16.  Then the aixterm colors are the
683          bright versions of the ISO colors:
684            Ps = 9 0  -> Set foreground color to Black.
685            Ps = 9 1  -> Set foreground color to Red.
686            Ps = 9 2  -> Set foreground color to Green.
687            Ps = 9 3  -> Set foreground color to Yellow.
688            Ps = 9 4  -> Set foreground color to Blue.
689            Ps = 9 5  -> Set foreground color to Magenta.
690            Ps = 9 6  -> Set foreground color to Cyan.
691            Ps = 9 7  -> Set foreground color to White.
692            Ps = 1 0 0  -> Set background color to Black.
693            Ps = 1 0 1  -> Set background color to Red.
694            Ps = 1 0 2  -> Set background color to Green.
695            Ps = 1 0 3  -> Set background color to Yellow.
696            Ps = 1 0 4  -> Set background color to Blue.
697            Ps = 1 0 5  -> Set background color to Magenta.
698            Ps = 1 0 6  -> Set background color to Cyan.
699            Ps = 1 0 7  -> Set background color to White.
700
701          If xterm is compiled with the 16-color support disabled, it
702          supports the following, from rxvt:
703            Ps = 1 0 0  -> Set foreground and background color to
704          default.
705
706          Xterm maintains a color palette whose entries are identified
707          by an index beginning with zero.  If 88- or 256-color support
708          is compiled, the following apply:
709          o All parameters are decimal integers.
710          o RGB values range from zero (0) to 255.
711          o ISO-8613-3 can be interpreted in more than one way; xterm
712            allows the semicolons in this control to be replaced by
713            colons (but after the first colon, colons must be used).
714
715          These ISO-8613-3 controls are supported:
716            Pm = 3 8 ; 2 ; Pr; Pg; Pb -> Set foreground color to the
717          closest match in xterm's palette for the given RGB Pr/Pg/Pb.
718            Pm = 3 8 ; 5 ; Ps -> Set foreground color to Ps.
719            Pm = 4 8 ; 2 ; Pr; Pg; Pb -> Set background color to the
720          closest match in xterm's palette for the given RGB Pr/Pg/Pb.
721            Pm = 4 8 ; 5 ; Ps -> Set background color to Ps.
722
723CSI > Ps; Ps m
724          Set or reset resource-values used by xterm to decide whether
725          to construct escape sequences holding information about the
726          modifiers pressed with a given key.  The first parameter iden-
727          tifies the resource to set/reset.  The second parameter is the
728          value to assign to the resource.  If the second parameter is
729          omitted, the resource is reset to its initial value.
730            Ps = 0  -> modifyKeyboard.
731            Ps = 1  -> modifyCursorKeys.
732            Ps = 2  -> modifyFunctionKeys.
733            Ps = 4  -> modifyOtherKeys.
734          If no parameters are given, all resources are reset to their
735          initial values.
736CSI Ps n  Device Status Report (DSR).
737            Ps = 5  -> Status Report.
738          Result ("OK") is CSI 0 n
739            Ps = 6  -> Report Cursor Position (CPR) [row;column].
740          Result is CSI r ; c R
741
742          Note: it is possible for this sequence to be sent by a func-
743          tion key.  For example, with the default keyboard configura-
744          tion the shifted F1 key may send (with shift-, control-, alt-
745          modifiers)
746            CSI 1  ; 2  R , or
747            CSI 1  ; 5  R , or
748            CSI 1  ; 6  R , etc.
749          The second parameter encodes the modifiers; values range from
750          2 to 16.  See the section PC-Style Function Keys for the
751          codes.  The modifyFunctionKeys and modifyKeyboard resources
752          can change the form of the string sent from the modified F1
753          key.
754
755CSI > Ps n
756          Disable modifiers which may be enabled via the CSI > Ps; Ps m
757          sequence.  This corresponds to a resource value of "-1", which
758          cannot be set with the other sequence.  The parameter identi-
759          fies the resource to be disabled:
760            Ps = 0  -> modifyKeyboard.
761            Ps = 1  -> modifyCursorKeys.
762            Ps = 2  -> modifyFunctionKeys.
763            Ps = 4  -> modifyOtherKeys.
764          If the parameter is omitted, modifyFunctionKeys is disabled.
765          When modifyFunctionKeys is disabled, xterm uses the modifier
766          keys to make an extended sequence of functions rather than
767          adding a parameter to each function key to denote the modi-
768          fiers.
769CSI ? Ps n
770          Device Status Report (DSR, DEC-specific).
771            Ps = 6  -> Report Cursor Position (DECXCPR) [row;column] as
772          CSI ? r ; c R (assumes the default page, i.e., "1").
773            Ps = 1 5  -> Report Printer status as CSI ? 1 0 n  (ready).
774          or CSI ? 1 1 n  (not ready).
775            Ps = 2 5  -> Report UDK status as CSI ? 2 0 n  (unlocked) or
776          CSI ? 2 1 n  (locked).
777            Ps = 2 6  -> Report Keyboard status as
778          CSI ? 2 7 ; 1 ; 0 ; 0 n  (North American).
779          The last two parameters apply to VT400 & up, and denote key-
780          board ready and LK01 respectively.
781            Ps = 5 3  -> Report Locator status as CSI ? 5 3 n  Locator
782          available, if compiled-in, or CSI ? 5 0 n  No Locator, if not.
783            Ps = 5 5  -> Report Locator status as CSI ? 5 3 n  Locator
784          available, if compiled-in, or CSI ? 5 0 n  No Locator, if not.
785            Ps = 5 6  -> Report Locator type as CSI ? 5 7 ; 1 n  Mouse,
786          if compiled-in, or CSI ? 5 7 ; 0 n  Cannot identify, if not.
787            Ps = 6 2  -> Report macro space (DECMSR) as CSI Pn \* { .
788            Ps = 6 3  -> Report memory checksum (DECCKSR) as DCS Pt ! x
789          x x x ST .
790              Pt is the request id (from an optional parameter to the
791          request).
792              The x's are hexadecimal digits 0-9 and A-F.
793            Ps = 7 5  -> Report data integrity as CSI ? 7 0 n  (ready,
794          no errors).
795            Ps = 8 5  -> Report multi-session configuration as CSI ? 8 3
796          n  (not configured for multiple-session operation).
797CSI > Ps p
798          Set resource value pointerMode.  This is used by xterm to
799          decide whether to hide the pointer cursor as the user types.
800          Valid values for the parameter:
801            Ps = 0  -> never hide the pointer.
802            Ps = 1  -> hide if the mouse tracking mode is not enabled.
803            Ps = 2  -> always hide the pointer, except when leaving the
804          window.
805            Ps = 3  -> always hide the pointer, even if leaving/entering
806          the window.  If no parameter is given, xterm uses the default,
807          which is 1 .
808CSI ! p   Soft terminal reset (DECSTR).
809CSI Ps ; Ps " p
810          Set conformance level (DECSCL).  Valid values for the first
811          parameter:
812            Ps = 6 1  -> VT100.
813            Ps = 6 2  -> VT200.
814            Ps = 6 3  -> VT300.
815          Valid values for the second parameter:
816            Ps = 0  -> 8-bit controls.
817            Ps = 1  -> 7-bit controls (always set for VT100).
818            Ps = 2  -> 8-bit controls.
819CSI Ps $ p
820          Request ANSI mode (DECRQM).  For VT300 and up, reply is
821            CSI Ps; Pm$ y
822          where Ps is the mode number as in RM, and Pm is the mode
823          value:
824            0 - not recognized
825            1 - set
826            2 - reset
827            3 - permanently set
828            4 - permanently reset
829CSI ? Ps$ p
830          Request DEC private mode (DECRQM).  For VT300 and up, reply is
831            CSI ? Ps; Pm$ y
832          where Ps is the mode number as in DECSET, Pm is the mode value
833          as in the ANSI DECRQM.
834CSI Ps q  Load LEDs (DECLL).
835            Ps = 0  -> Clear all LEDS (default).
836            Ps = 1  -> Light Num Lock.
837            Ps = 2  -> Light Caps Lock.
838            Ps = 3  -> Light Scroll Lock.
839            Ps = 2  1  -> Extinguish Num Lock.
840            Ps = 2  2  -> Extinguish Caps Lock.
841            Ps = 2  3  -> Extinguish Scroll Lock.
842CSI Ps SP q
843          Set cursor style (DECSCUSR, VT520).
844            Ps = 0  -> blinking block.
845            Ps = 1  -> blinking block (default).
846            Ps = 2  -> steady block.
847            Ps = 3  -> blinking underline.
848            Ps = 4  -> steady underline.
849            Ps = 5  -> blinking bar (xterm).
850            Ps = 6  -> steady bar (xterm).
851CSI Ps " q
852          Select character protection attribute (DECSCA).  Valid values
853          for the parameter:
854            Ps = 0  -> DECSED and DECSEL can erase (default).
855            Ps = 1  -> DECSED and DECSEL cannot erase.
856            Ps = 2  -> DECSED and DECSEL can erase.
857CSI Ps ; Ps r
858          Set Scrolling Region [top;bottom] (default = full size of win-
859          dow) (DECSTBM).
860CSI ? Pm r
861          Restore DEC Private Mode Values.  The value of Ps previously
862          saved is restored.  Ps values are the same as for DECSET.
863CSI Pt; Pl; Pb; Pr; Ps$ r
864          Change Attributes in Rectangular Area (DECCARA), VT400 and up.
865            Pt; Pl; Pb; Pr denotes the rectangle.
866            Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7.
867CSI s     Save cursor (ANSI.SYS), available only when DECLRMM is dis-
868          abled.
869CSI Pl; Pr s
870          Set left and right margins (DECSLRM), available only when
871          DECLRMM is enabled (VT420 and up).
872CSI ? Pm s
873          Save DEC Private Mode Values.  Ps values are the same as for
874          DECSET.
875CSI Ps ; Ps ; Ps t
876          Window manipulation (from dtterm, as well as extensions).
877          These controls may be disabled using the allowWindowOps
878          resource.  Valid values for the first (and any additional
879          parameters) are:
880            Ps = 1  -> De-iconify window.
881            Ps = 2  -> Iconify window.
882            Ps = 3  ;  x ;  y -> Move window to [x, y].
883            Ps = 4  ;  height ;  width -> Resize the xterm window to
884          given height and width in pixels.  Omitted parameters reuse
885          the current height or width.  Zero parameters use the dis-
886          play's height or width.
887            Ps = 5  -> Raise the xterm window to the front of the stack-
888          ing order.
889            Ps = 6  -> Lower the xterm window to the bottom of the
890          stacking order.
891            Ps = 7  -> Refresh the xterm window.
892            Ps = 8  ;  height ;  width -> Resize the text area to given
893          height and width in characters.  Omitted parameters reuse the
894          current height or width.  Zero parameters use the display's
895          height or width.
896            Ps = 9  ;  0  -> Restore maximized window.
897            Ps = 9  ;  1  -> Maximize window (i.e., resize to screen
898          size).
899            Ps = 9  ;  2  -> Maximize window vertically.
900            Ps = 9  ;  3  -> Maximize window horizontally.
901            Ps = 1 0  ;  0  -> Undo full-screen mode.
902            Ps = 1 0  ;  1  -> Change to full-screen.
903            Ps = 1 0  ;  2  -> Toggle full-screen.
904            Ps = 1 1  -> Report xterm window state.  If the xterm window
905          is open (non-iconified), it returns CSI 1 t .  If the xterm
906          window is iconified, it returns CSI 2 t .
907            Ps = 1 3  -> Report xterm window position.
908          Result is CSI 3 ; x ; y t
909            Ps = 1 4  -> Report xterm window in pixels.
910          Result is CSI  4  ;  height ;  width t
911            Ps = 1 8  -> Report the size of the text area in characters.
912          Result is CSI  8  ;  height ;  width t
913            Ps = 1 9  -> Report the size of the screen in characters.
914          Result is CSI  9  ;  height ;  width t
915            Ps = 2 0  -> Report xterm window's icon label.
916          Result is OSC  L  label ST
917            Ps = 2 1  -> Report xterm window's title.
918          Result is OSC  l  label ST
919            Ps = 2 2  ;  0  -> Save xterm icon and window title on
920          stack.
921            Ps = 2 2  ;  1  -> Save xterm icon title on stack.
922            Ps = 2 2  ;  2  -> Save xterm window title on stack.
923            Ps = 2 3  ;  0  -> Restore xterm icon and window title from
924          stack.
925            Ps = 2 3  ;  1  -> Restore xterm icon title from stack.
926            Ps = 2 3  ;  2  -> Restore xterm window title from stack.
927            Ps >= 2 4  -> Resize to Ps lines (DECSLPP).
928CSI > Ps; Ps t
929          Set one or more features of the title modes.  Each parameter
930          enables a single feature.
931            Ps = 0  -> Set window/icon labels using hexadecimal.
932            Ps = 1  -> Query window/icon labels using hexadecimal.
933            Ps = 2  -> Set window/icon labels using UTF-8.
934            Ps = 3  -> Query window/icon labels using UTF-8.  (See dis-
935          cussion of "Title Modes")
936CSI Ps SP t
937          Set warning-bell volume (DECSWBV, VT520).
938            Ps = 0  or 1  -> off.
939            Ps = 2 , 3  or 4  -> low.
940            Ps = 5 , 6 , 7 , or 8  -> high.
941CSI Pt; Pl; Pb; Pr; Ps$ t
942          Reverse Attributes in Rectangular Area (DECRARA), VT400 and
943          up.
944            Pt; Pl; Pb; Pr denotes the rectangle.
945            Ps denotes the attributes to reverse, i.e.,  1, 4, 5, 7.
946CSI u     Restore cursor (ANSI.SYS).
947CSI Ps SP u
948          Set margin-bell volume (DECSMBV, VT520).
949            Ps = 1  -> off.
950            Ps = 2 , 3  or 4  -> low.
951            Ps = 0 , 5 , 6 , 7 , or 8  -> high.
952CSI Pt; Pl; Pb; Pr; Pp; Pt; Pl; Pp$ v
953          Copy Rectangular Area (DECCRA, VT400 and up).
954            Pt; Pl; Pb; Pr denotes the rectangle.
955            Pp denotes the source page.
956            Pt; Pl denotes the target location.
957            Pp denotes the target page.
958CSI Pt ; Pl ; Pb ; Pr ' w
959          Enable Filter Rectangle (DECEFR), VT420 and up.
960          Parameters are [top;left;bottom;right].
961          Defines the coordinates of a filter rectangle and activates
962          it.  Anytime the locator is detected outside of the filter
963          rectangle, an outside rectangle event is generated and the
964          rectangle is disabled.  Filter rectangles are always treated
965          as "one-shot" events.  Any parameters that are omitted default
966          to the current locator position.  If all parameters are omit-
967          ted, any locator motion will be reported.  DECELR always can-
968          cels any prevous rectangle definition.
969CSI Ps x  Request Terminal Parameters (DECREQTPARM).
970          if Ps is a "0" (default) or "1", and xterm is emulating VT100,
971          the control sequence elicits a response of the same form whose
972          parameters describe the terminal:
973            Ps -> the given Ps incremented by 2.
974            Pn = 1  <- no parity.
975            Pn = 1  <- eight bits.
976            Pn = 1  <- 2  8  transmit 38.4k baud.
977            Pn = 1  <- 2  8  receive 38.4k baud.
978            Pn = 1  <- clock multiplier.
979            Pn = 0  <- STP flags.
980CSI Ps * x
981          Select Attribute Change Extent (DECSACE).
982            Ps = 0  -> from start to end position, wrapped.
983            Ps = 1  -> from start to end position, wrapped.
984            Ps = 2  -> rectangle (exact).
985CSI Pc ; Pt ; Pl ; Pb ; Pr $ x
986          Fill Rectangular Area (DECFRA), VT420 and up.
987            Pc is the character to use.
988            Pt; Pl; Pb; Pr denotes the rectangle.
989CSI Pi ; Pg ; Pt; Pl; Pb; Pr * y
990          Request Checksum of Rectangular Area (DECRQCRA), VT420 and up.
991          Response is
992          DCS Pi ! x x x x ST
993            Pi is the request id.
994            Pg is the page number.
995            Pt; Pl; Pb; Pr denotes the rectangle.
996            The x's are hexadecimal digits 0-9 and A-F.
997CSI Ps ; Pu ' z
998          Enable Locator Reporting (DECELR).
999          Valid values for the first parameter:
1000            Ps = 0  -> Locator disabled (default).
1001            Ps = 1  -> Locator enabled.
1002            Ps = 2  -> Locator enabled for one report, then disabled.
1003          The second parameter specifies the coordinate unit for locator
1004          reports.
1005          Valid values for the second parameter:
1006            Pu = 0  <- or omitted -> default to character cells.
1007            Pu = 1  <- device physical pixels.
1008            Pu = 2  <- character cells.
1009CSI Pt; Pl; Pb; Pr$ z
1010          Erase Rectangular Area (DECERA), VT400 and up.
1011            Pt; Pl; Pb; Pr denotes the rectangle.
1012CSI Pm ' {
1013          Select Locator Events (DECSLE).
1014          Valid values for the first (and any additional parameters)
1015          are:
1016            Ps = 0  -> only respond to explicit host requests (DECRQLP).
1017                       (This is default).  It also cancels any filter
1018                       rectangle.
1019            Ps = 1  -> report button down transitions.
1020            Ps = 2  -> do not report button down transitions.
1021            Ps = 3  -> report button up transitions.
1022            Ps = 4  -> do not report button up transitions.
1023CSI Pt; Pl; Pb; Pr $ {
1024          Selective Erase Rectangular Area (DECSERA), VT400 and up.
1025            Pt; Pl; Pb; Pr denotes the rectangle.
1026CSI Ps ' |
1027          Request Locator Position (DECRQLP).
1028          Valid values for the parameter are:
1029            Ps = 0 , 1 or omitted -> transmit a single DECLRP locator
1030          report.
1031
1032          If Locator Reporting has been enabled by a DECELR, xterm will
1033          respond with a DECLRP Locator Report.  This report is also
1034          generated on button up and down events if they have been
1035          enabled with a DECSLE, or when the locator is detected outside
1036          of a filter rectangle, if filter rectangles have been enabled
1037          with a DECEFR.
1038
1039            -> CSI Pe ; Pb ; Pr ; Pc ; Pp &  w
1040
1041          Parameters are [event;button;row;column;page].
1042          Valid values for the event:
1043            Pe = 0  -> locator unavailable - no other parameters sent.
1044            Pe = 1  -> request - xterm received a DECRQLP.
1045            Pe = 2  -> left button down.
1046            Pe = 3  -> left button up.
1047            Pe = 4  -> middle button down.
1048            Pe = 5  -> middle button up.
1049            Pe = 6  -> right button down.
1050            Pe = 7  -> right button up.
1051            Pe = 8  -> M4 button down.
1052            Pe = 9  -> M4 button up.
1053            Pe = 1 0  -> locator outside filter rectangle.
1054          The "button" parameter is a bitmask indicating which buttons
1055          are pressed:
1056            Pb = 0  <- no buttons down.
1057            Pb & 1  <- right button down.
1058            Pb & 2  <- middle button down.
1059            Pb & 4  <- left button down.
1060            Pb & 8  <- M4 button down.
1061          The "row" and "column" parameters are the coordinates of the
1062          locator position in the xterm window, encoded as ASCII deci-
1063          mal.
1064          The "page" parameter is not used by xterm.
1065CSI Pm ' }
1066          Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.
1067CSI Pm ' ~
1068          Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.
1069
1070Operating System Commands
1071OSC Ps ; Pt BEL
1072OSC Ps ; Pt ST
1073          Set Text Parameters.  For colors and font, if Pt is a "?", the
1074          control sequence elicits a response which consists of the con-
1075          trol sequence which would set the corresponding value.  The
1076          dtterm control sequences allow you to determine the icon name
1077          and window title.
1078            Ps = 0  -> Change Icon Name and Window Title to Pt.
1079            Ps = 1  -> Change Icon Name to Pt.
1080            Ps = 2  -> Change Window Title to Pt.
1081            Ps = 3  -> Set X property on top-level window.  Pt should be
1082          in the form "prop=value", or just "prop" to delete the prop-
1083          erty
1084            Ps = 4 ; c; spec -> Change Color Number c to the color spec-
1085          ified by spec.  This can be a name or RGB specification as per
1086          XParseColor.  Any number of c/spec pairs may be given.  The
1087          color numbers correspond to the ANSI colors 0-7, their bright
1088          versions 8-15, and if supported, the remainder of the 88-color
1089          or 256-color table.
1090
1091          If a "?" is given rather than a name or RGB specification,
1092          xterm replies with a control sequence of the same form which
1093          can be used to set the corresponding color.  Because more than
1094          one pair of color number and specification can be given in one
1095          control sequence, xterm can make more than one reply.
1096
1097            Ps = 5 ; c; spec -> Change Special Color Number c to the
1098          color specified by spec.  This can be a name or RGB specifica-
1099          tion as per XParseColor.  Any number of c/spec pairs may be
1100          given.  The special colors can also be set by adding the maxi-
1101          mum number of colors to these codes in an OSC 4  control:
1102
1103              Pc = 0  <- resource colorBD (BOLD).
1104              Pc = 1  <- resource colorUL (UNDERLINE).
1105              Pc = 2  <- resource colorBL (BLINK).
1106              Pc = 3  <- resource colorRV (REVERSE).
1107              Pc = 4  <- resource colorIT (ITALIC).
1108
1109            Ps = 6 ; c; f -> Enable/disable Special Color Number c.  OSC
1110          6  is the same as OSC 1 0 6 .
1111
1112          The 10 colors (below) which may be set or queried using 1 0
1113          through 1 9  are denoted dynamic colors, since the correspond-
1114          ing control sequences were the first means for setting xterm's
1115          colors dynamically, i.e., after it was started.  They are not
1116          the same as the ANSI colors.  These controls may be disabled
1117          using the allowColorOps resource.  At least one parameter is
1118          expected for Pt.  Each successive parameter changes the next
1119          color in the list.  The value of Ps tells the starting point
1120          in the list.  The colors are specified by name or RGB specifi-
1121          cation as per XParseColor.
1122
1123          If a "?" is given rather than a name or RGB specification,
1124          xterm replies with a control sequence of the same form which
1125          can be used to set the corresponding dynamic color.  Because
1126          more than one pair of color number and specification can be
1127          given in one control sequence, xterm can make more than one
1128          reply.
1129
1130            Ps = 1 0  -> Change VT100 text foreground color to Pt.
1131            Ps = 1 1  -> Change VT100 text background color to Pt.
1132            Ps = 1 2  -> Change text cursor color to Pt.
1133            Ps = 1 3  -> Change mouse foreground color to Pt.
1134            Ps = 1 4  -> Change mouse background color to Pt.
1135            Ps = 1 5  -> Change Tektronix foreground color to Pt.
1136            Ps = 1 6  -> Change Tektronix background color to Pt.
1137            Ps = 1 7  -> Change highlight background color to Pt.
1138            Ps = 1 8  -> Change Tektronix cursor color to Pt.
1139            Ps = 1 9  -> Change highlight foreground color to Pt.
1140
1141            Ps = 4 6  -> Change Log File to Pt.  (This is normally dis-
1142          abled by a compile-time option).
1143
1144            Ps = 5 0  -> Set Font to Pt.  These controls may be disabled
1145          using the allowFontOps resource.  If Pt begins with a "#",
1146          index in the font menu, relative (if the next character is a
1147          plus or minus sign) or absolute.  A number is expected but not
1148          required after the sign (the default is the current entry for
1149          relative, zero for absolute indexing).
1150          The same rule (plus or minus sign, optional number) is used
1151          when querying the font.  The remainder of Pt is ignored.
1152          A font can be specified after a "#" index expression, by
1153          adding a space and then the font specifier.
1154          If the "TrueType Fonts" menu entry is set (the renderFont
1155          resource), then this control sets/queries the faceName
1156          resource.
1157
1158            Ps = 5 1  -> reserved for Emacs shell.
1159
1160            Ps = 5 2  -> Manipulate Selection Data.  These controls may
1161          be disabled using the allowWindowOps resource.  The parameter
1162          Pt is parsed as
1163               Pc; Pd
1164          The first, Pc, may contain zero or more characters from the
1165          set c  p  s  0  1  2  3  4  5  6  7 .  It is used to construct
1166          a list of selection parameters for clipboard, primary, select,
1167          or cut buffers 0 through 7 respectively, in the order given.
1168          If the parameter is empty, xterm uses s 0 , to specify the
1169          configurable primary/clipboard selection and cut buffer 0.
1170          The second parameter, Pd, gives the selection data.  Normally
1171          this is a string encoded in base64.  The data becomes the new
1172          selection, which is then available for pasting by other appli-
1173          cations.
1174          If the second parameter is a ? , xterm replies to the host
1175          with the selection data encoded using the same protocol.
1176          If the second parameter is neither a base64 string nor ? ,
1177          then the selection is cleared.
1178
1179            Ps = 1 0 4 ; c -> Reset Color Number c.  It is reset to the
1180          color specified by the corresponding X resource.  Any number
1181          of c parameters may be given.  These parameters correspond to
1182          the ANSI colors 0-7, their bright versions 8-15, and if sup-
1183          ported, the remainder of the 88-color or 256-color table.  If
1184          no parameters are given, the entire table will be reset.
1185
1186            Ps = 1 0 5 ; c -> Reset Special Color Number c.  It is reset
1187          to the color specified by the corresponding X resource.  Any
1188          number of c parameters may be given.  These parameters corre-
1189          spond to the special colors which can be set using an OSC 5
1190          control (or by adding the maximum number of colors using an
1191          OSC 4  control).
1192
1193            Ps = 1 0 6 ; c; f -> Enable/disable Special Color Number c.
1194          The second parameter tells xterm to enable the corresponding
1195          color mode if nonzero, disable it if zero.
1196
1197              Pc = 0  <- resource colorBDMode (BOLD).
1198              Pc = 1  <- resource colorULMode (UNDERLINE).
1199              Pc = 2  <- resource colorBLMode (BLINK).
1200              Pc = 3  <- resource colorRVMode (REVERSE).
1201              Pc = 4  <- resource colorITMode (ITALIC).
1202              Pc = 5  <- resource colorAttrMode (Override ANSI).
1203
1204          The dynamic colors can also be reset to their default
1205          (resource) values:
1206            Ps = 1 1 0  -> Reset VT100 text foreground color.
1207            Ps = 1 1 1  -> Reset VT100 text background color.
1208            Ps = 1 1 2  -> Reset text cursor color.
1209            Ps = 1 1 3  -> Reset mouse foreground color.
1210            Ps = 1 1 4  -> Reset mouse background color.
1211            Ps = 1 1 5  -> Reset Tektronix foreground color.
1212            Ps = 1 1 6  -> Reset Tektronix background color.
1213            Ps = 1 1 7  -> Reset highlight color.
1214            Ps = 1 1 8  -> Reset Tektronix cursor color.
1215            Ps = 1 1 9  -> Reset highlight foreground color.
1216
1217Privacy Message
1218PM Pt ST  xterm implements no PM  functions; Pt is ignored.  Pt need not
1219          be printable characters.
1220
1221Alt and Meta Keys
1222Many keyboards have keys labeled "Alt".  Few have keys labeled "Meta".
1223However, xterm's default translations use the Meta modifier.  Common
1224keyboard configurations assign the Meta modifier to an "Alt" key.  By
1225using xmodmap one may have the modifier assigned to a different key, and
1226have "real" alt and meta keys.  Here is an example:
1227
1228     ! put meta on mod3 to distinguish it from alt
1229     keycode 64 = Alt_L
1230     clear mod1
1231     add mod1 = Alt_L
1232     keycode 115 = Meta_L
1233     clear mod3
1234     add mod3 = Meta_L
1235
1236
1237The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set)
1238can be used to control the way the Meta modifier applies to ordinary
1239keys unless the modifyOtherKeys resource is set:
1240          - prefix a key with the ESC  character.
1241          - shift the key from codes 0-127 to 128-255 by adding 128.
1242
1243The table shows the result for a given character "x" with modifiers
1244according to the default translations with the resources set on or off.
1245This assumes altIsNotMeta is set:
1246
1247       -----------------------------------------------------------
1248       key          altSendsEscape   metaSendsEscape   result
1249       -----------+----------------+-----------------+------------
1250       x          | off            | off             | x
1251       Meta-x     | off            | off             | shift
1252       Alt-x      | off            | off             | shift
1253       Alt+Meta-x | off            | off             | shift
1254       x          | ON             | off             | x
1255       Meta-x     | ON             | off             | shift
1256       Alt-x      | ON             | off             | ESC  x
1257       Alt+Meta-x | ON             | off             | ESC  shift
1258       x          | off            | ON              | x
1259       Meta-x     | off            | ON              | ESC  x
1260       Alt-x      | off            | ON              | shift
1261       Alt+Meta-x | off            | ON              | ESC  shift
1262       x          | ON             | ON              | x
1263       Meta-x     | ON             | ON              | ESC  x
1264       Alt-x      | ON             | ON              | ESC  x
1265       Alt+Meta-x | ON             | ON              | ESC  x
1266       -----------+----------------+-----------------+------------
1267
1268
1269PC-Style Function Keys
1270If xterm does minimal translation of the function keys, it usually does
1271this with a PC-style keyboard, so PC-style function keys result.  Sun
1272keyboards are similar to PC keyboards.  Both have cursor and scrolling
1273operations printed on the keypad, which duplicate the smaller cursor and
1274scrolling keypads.
1275
1276X does not predefine NumLock (used for VT220 keyboards) or Alt (used as
1277an extension for the Sun/PC keyboards) as modifiers.  These keys are
1278recognized as modifiers when enabled by the numLock resource, or by the
1279"DECSET 1 0 3 5 " control sequence.
1280
1281The cursor keys transmit the following escape sequences depending on the
1282mode specified via the DECCKM escape sequence.
1283
1284                  Key            Normal     Application
1285                  -------------+----------+-------------
1286                  Cursor Up    | CSI A    | SS3 A
1287                  Cursor Down  | CSI B    | SS3 B
1288                  Cursor Right | CSI C    | SS3 C
1289                  Cursor Left  | CSI D    | SS3 D
1290                  -------------+----------+-------------
1291
1292The home- and end-keys (unlike PageUp and other keys also on the 6-key
1293editing keypad) are considered "cursor keys" by xterm.  Their mode is
1294also controlled by the DECCKM escape sequence:
1295
1296                    Key        Normal     Application
1297                    ---------+----------+-------------
1298                    Home     | CSI H    | SS3 H
1299                    End      | CSI F    | SS3 F
1300                    ---------+----------+-------------
1301
1302
1303The application keypad transmits the following escape sequences depend-
1304ing on the mode specified via the DECKPNM and DECKPAM escape sequences.
1305Use the NumLock key to override the application mode.
1306
1307Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are
1308supported by the program.
1309
1310      Key              Numeric    Application   Terminfo   Termcap
1311      ---------------+----------+-------------+----------+----------
1312      Space          | SP       | SS3 SP      | -        | -
1313      Tab            | TAB      | SS3 I       | -        | -
1314      Enter          | CR       | SS3 M       | kent     | @8
1315      PF1            | SS3 P    | SS3 P       | kf1      | k1
1316      PF2            | SS3 Q    | SS3 Q       | kf2      | k2
1317      PF3            | SS3 R    | SS3 R       | kf3      | k3
1318      PF4            | SS3 S    | SS3 S       | kf4      | k4
1319      * (multiply)   | *        | SS3 j       | -        | -
1320      + (add)        | +        | SS3 k       | -        | -
1321      , (comma)      | ,        | SS3 l       | -        | -
1322      - (minus)      | -        | SS3 m       | -        | -
1323      . (Delete)     | .        | CSI 3 ~     | -        | -
1324      / (divide)     | /        | SS3 o       | -        | -
1325      0 (Insert)     | 0        | CSI 2 ~     | -        | -
1326      1 (End)        | 1        | SS3 F       | kc1      | K4
1327      2 (DownArrow)  | 2        | CSI B       | -        | -
1328      3 (PageDown)   | 3        | CSI 6 ~     | kc3      | K5
1329      4 (LeftArrow)  | 4        | CSI D       | -        | -
1330      5 (Begin)      | 5        | CSI E       | kb2      | K2
1331      6 (RightArrow) | 6        | CSI C       | -        | -
1332      7 (Home)       | 7        | SS3 H       | ka1      | K1
1333      8 (UpArrow)    | 8        | CSI A       | -        | -
1334      9 (PageUp)     | 9        | CSI 5 ~     | ka3      | K3
1335      = (equal)      | =        | SS3 X       | -        | -
1336      ---------------+----------+-------------+----------+----------
1337
1338They also provide 12 function keys, as well as a few other special-pur-
1339pose keys:
1340
1341                       Key        Escape Sequence
1342                       ---------+-----------------
1343                       F1       | SS3 P
1344                       F2       | SS3 Q
1345                       F3       | SS3 R
1346                       F4       | SS3 S
1347                       F5       | CSI 1 5 ~
1348                       F6       | CSI 1 7 ~
1349                       F7       | CSI 1 8 ~
1350                       F8       | CSI 1 9 ~
1351                       F9       | CSI 2 0 ~
1352                       F10      | CSI 2 1 ~
1353                       F11      | CSI 2 3 ~
1354                       F12      | CSI 2 4 ~
1355                       ---------+-----------------
1356
1357
1358Note that F1 through F4 are prefixed with SS3 , while the other keys are
1359prefixed with CSI .  Older versions of xterm implement different escape
1360sequences for F1 through F4, with a CSI  prefix.  These can be activated
1361by setting the oldXtermFKeys resource.  However, since they do not cor-
1362respond to any hardware terminal, they have been deprecated.  (The DEC
1363VT220 reserves F1 through F5 for local functions such as Setup).
1364
1365                       Key        Escape Sequence
1366                       ---------+-----------------
1367                       F1       | CSI 1 1 ~
1368                       F2       | CSI 1 2 ~
1369                       F3       | CSI 1 3 ~
1370                       F4       | CSI 1 4 ~
1371                       ---------+-----------------
1372
1373In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is
1374false (and none of the other keyboard resources such as oldXtermFKeys
1375resource is set), xterm encodes function key modifiers as parameters
1376appended before the final character of the control sequence.  As a spe-
1377cial case, the SS3  sent before F1 through F4 is altered to CSI  when
1378sending a function key modifier as a parameter.
1379
1380                    Code     Modifiers
1381                  ---------+---------------------------
1382                     2     | Shift
1383                     3     | Alt
1384                     4     | Shift + Alt
1385                     5     | Control
1386                     6     | Shift + Control
1387                     7     | Alt + Control
1388                     8     | Shift + Alt + Control
1389                     9     | Meta
1390                     10    | Meta + Shift
1391                     11    | Meta + Alt
1392                     12    | Meta + Alt + Shift
1393                     13    | Meta + Ctrl
1394                     14    | Meta + Ctrl + Shift
1395                     15    | Meta + Ctrl + Alt
1396                     16    | Meta + Ctrl + Alt + Shift
1397                  ---------+---------------------------
1398
1399For example, shift-F5 would be sent as CSI 1 5 ; 2 ~
1400
1401If the alwaysUseMods resource is set, the Meta modifier also is recog-
1402nized, making parameters 9 through 16.
1403
1404VT220-Style Function Keys
1405However, xterm is most useful as a DEC VT102 or VT220 emulator.  Set the
1406sunKeyboard resource to true to force a Sun/PC keyboard to act like a
1407VT220 keyboard.
1408
1409The VT102/VT220 application keypad transmits unique escape sequences in
1410application mode, which are distinct from the cursor and scrolling key-
1411pad:
1412
1413                  Key            Numeric    Application
1414                  -------------+----------+-------------
1415                  Space        | SP       | SS3 SP
1416                  Tab          | TAB      | SS3 I
1417                  Enter        | CR       | SS3 M
1418                  PF1          | SS3 P    | SS3 P
1419                  PF2          | SS3 Q    | SS3 Q
1420                  PF3          | SS3 R    | SS3 R
1421                  PF4          | SS3 S    | SS3 S
1422                  * (multiply) | *        | SS3 j
1423                  + (add)      | +        | SS3 k
1424                  , (comma)    | ,        | SS3 l
1425                  - (minus)    | -        | SS3 m
1426                  . (period)   | .        | SS3 n
1427                  / (divide)   | /        | SS3 o
1428                  0            | 0        | SS3 p
1429                  1            | 1        | SS3 q
1430                  2            | 2        | SS3 r
1431                  3            | 3        | SS3 s
1432                  4            | 4        | SS3 t
1433                  5            | 5        | SS3 u
1434                  6            | 6        | SS3 v
1435                  7            | 7        | SS3 w
1436                  8            | 8        | SS3 x
1437                  9            | 9        | SS3 y
1438                  = (equal)    | =        | SS3 X
1439                  -------------+----------+-------------
1440
1441The VT220 provides a 6-key editing keypad, which is analogous to that on
1442the PC keyboard.  It is not affected by DECCKM or DECKPNM/DECKPAM:
1443
1444                   Key        Normal     Application
1445                   ---------+----------+-------------
1446                   Insert   | CSI 2 ~  | CSI 2 ~
1447                   Delete   | CSI 3 ~  | CSI 3 ~
1448                   Home     | CSI 1 ~  | CSI 1 ~
1449                   End      | CSI 4 ~  | CSI 4 ~
1450                   PageUp   | CSI 5 ~  | CSI 5 ~
1451                   PageDown | CSI 6 ~  | CSI 6 ~
1452                   ---------+----------+-------------
1453
1454The VT220 provides 8 additional function keys.  With a Sun/PC keyboard,
1455access these keys by Control/F1 for F13, etc.
1456
1457                       Key        Escape Sequence
1458                       ---------+-----------------
1459                       F13      | CSI 2 5 ~
1460                       F14      | CSI 2 6 ~
1461                       F15      | CSI 2 8 ~
1462                       F16      | CSI 2 9 ~
1463                       F17      | CSI 3 1 ~
1464                       F18      | CSI 3 2 ~
1465                       F19      | CSI 3 3 ~
1466                       F20      | CSI 3 4 ~
1467                       ---------+-----------------
1468
1469
1470VT52-Style Function Keys
1471A VT52 does not have function keys, but it does have a numeric keypad
1472and cursor keys.  They differ from the other emulations by the prefix.
1473Also, the cursor keys do not change:
1474
1475                   Key            Normal/Application
1476                   -------------+--------------------
1477                   Cursor Up    | ESC A
1478                   Cursor Down  | ESC B
1479                   Cursor Right | ESC C
1480                   Cursor Left  | ESC D
1481                   -------------+--------------------
1482
1483The keypad is similar:
1484
1485                  Key            Numeric    Application
1486                  -------------+----------+-------------
1487                  Space        | SP       | ESC ? SP
1488                  Tab          | TAB      | ESC ? I
1489                  Enter        | CR       | ESC ? M
1490                  PF1          | ESC P    | ESC P
1491                  PF2          | ESC Q    | ESC Q
1492                  PF3          | ESC R    | ESC R
1493                  PF4          | ESC S    | ESC S
1494                  * (multiply) | *        | ESC ? j
1495                  + (add)      | +        | ESC ? k
1496                  , (comma)    | ,        | ESC ? l
1497                  - (minus)    | -        | ESC ? m
1498                  . (period)   | .        | ESC ? n
1499                  / (divide)   | /        | ESC ? o
1500                  0            | 0        | ESC ? p
1501                  1            | 1        | ESC ? q
1502                  2            | 2        | ESC ? r
1503                  3            | 3        | ESC ? s
1504                  4            | 4        | ESC ? t
1505                  5            | 5        | ESC ? u
1506                  6            | 6        | ESC ? v
1507                  7            | 7        | ESC ? w
1508                  8            | 8        | ESC ? x
1509                  9            | 9        | ESC ? y
1510                  = (equal)    | =        | ESC ? X
1511                  -------------+----------+-------------
1512
1513
1514Sun-Style Function Keys
1515The xterm program provides support for Sun keyboards more directly, by a
1516menu toggle that causes it to send Sun-style function key codes rather
1517than VT220.  Note, however, that the sun and VT100 emulations are not
1518really compatible.  For example, their wrap-margin behavior differs.
1519
1520Only function keys are altered; keypad and cursor keys are the same.
1521The emulation responds identically.  See the xterm-sun terminfo entry
1522for details.
1523
1524HP-Style Function Keys
1525Similarly, xterm can be compiled to support HP keyboards.  See the
1526xterm-hp terminfo entry for details.
1527
1528The Alternate Screen Buffer
1529Xterm maintains two screen buffers.  The normal screen buffer allows you
1530to scroll back to view saved lines of output up to the maximum set by
1531the saveLines resource.  The alternate screen buffer is exactly as large
1532as the display, contains no additional saved lines.  When the alternate
1533screen buffer is active, you cannot scroll back to view saved lines.
1534Xterm provides control sequences and menu entries for switching between
1535the two.
1536
1537Most full-screen applications use terminfo or termcap to obtain strings
1538used to start/stop full-screen mode, i.e., smcup and rmcup for terminfo,
1539or the corresponding ti and te for termcap.  The titeInhibit resource
1540removes the ti and te strings from the TERMCAP string which is set in
1541the environment for some platforms.  That is not done when xterm is
1542built with terminfo libraries because terminfo does not provide the
1543whole text of the termcap data in one piece.  It would not work for ter-
1544minfo anyway, since terminfo data is not passed in environment vari-
1545ables; setting an environment variable in this manner would have no
1546effect on the application's ability to switch between normal and alter-
1547nate screen buffers.  Instead, the newer private mode controls (such as
15481 0 4 9 ) for switching between normal and alternate screen buffers sim-
1549ply disable the switching.  They add other features such as clearing the
1550display for the same reason: to make the details of switching indepen-
1551dent of the application that requests the switch.
1552
1553Bracketed Paste Mode
1554When bracketed paste mode is set, pasted text is bracketed with control
1555sequences so that the program can differentiate pasted text from typed-
1556in text.  When bracketed paste mode is set, the program will receive:
1557   ESC [ 2 0 0 ~ ,
1558followed by the pasted text, followed by
1559   ESC [ 2 0 1 ~ .
1560
1561Title Modes
1562The window- and icon-labels can be set or queried using control
1563sequences.  As a VT220-emulator, xterm "should" limit the character
1564encoding for the corresponding strings to ISO-8859-1.  Indeed, it used
1565to be the case (and was documented) that window titles had to be
1566ISO-8859-1.  This is no longer the case.  However, there are many appli-
1567cations which still assume that titles are set using ISO-8859-1.  So
1568that is the default behavior.
1569
1570If xterm is running with UTF-8 encoding, it is possible to use window-
1571and icon-labels encoded using UTF-8.  That is because the underlying X
1572libraries (and many, but not all) window managers support this feature.
1573
1574The utf8Title X resource setting tells xterm to disable a reconversion
1575of the title string back to ISO-8859-1, allowing the title strings to be
1576interpreted as UTF-8.  The same feature can be enabled using the title
1577mode control sequence described in this summary.
1578
1579Separate from the ability to set the titles, xterm provides the ability
1580to query the titles, returning them either in ISO-8859-1 or UTF-8.  This
1581choice is available only while xterm is using UTF-8 encoding.
1582
1583Finally, the characters sent to, or returned by a title control are less
1584constrained than the rest of the control sequences.  To make them more
1585manageable (and constrained), for use in shell scripts, xterm has an
1586optional feature which decodes the string from hexadecimal (for setting
1587titles) or for encoding the title into hexadecimal when querying the
1588value.
1589
1590Mouse Tracking
1591The VT widget can be set to send the mouse position and other informa-
1592tion on button presses.  These modes are typically used by editors and
1593other full-screen applications that want to make use of the mouse.
1594
1595There are two sets of mutually exclusive modes:
1596o mouse protocol
1597o protocol encoding
1598
1599The mouse protocols include DEC Locator mode, enabled by the DECELR CSI
1600Ps ; Ps  '  z control sequence, and is not described here (control
1601sequences are summarized above).  The remaining five modes of the mouse
1602protocols are each enabled (or disabled) by a different parameter in the
1603"DECSET CSI ? Pm h " or "DECRST CSI ? Pm l " control sequence.
1604
1605Manifest constants for the parameter values are defined in xcharmouse.h
1606as follows:
1607
1608     #define SET_X10_MOUSE               9
1609     #define SET_VT200_MOUSE             1000
1610     #define SET_VT200_HIGHLIGHT_MOUSE   1001
1611     #define SET_BTN_EVENT_MOUSE         1002
1612     #define SET_ANY_EVENT_MOUSE         1003
1613
1614     #define SET_FOCUS_EVENT_MOUSE       1004
1615
1616     #define SET_EXT_MODE_MOUSE          1005
1617     #define SET_SGR_EXT_MODE_MOUSE      1006
1618     #define SET_URXVT_EXT_MODE_MOUSE    1015
1619
1620     #define SET_ALTERNATE_SCROLL        1007
1621
1622The motion reporting modes are strictly xterm extensions, and are not
1623part of any standard, though they are analogous to the DEC VT200 DECELR
1624locator reports.
1625
1626Normally, parameters (such as pointer position and button number) for
1627all mouse tracking escape sequences generated by xterm encode numeric
1628parameters in a single character as value+32.  For example, !  specifies
1629the value 1.  The upper left character position on the terminal is
1630denoted as 1,1.  This scheme dates back to X10, though the normal mouse-
1631tracking (from X11) is more elaborate.
1632X10 compatbility mode
1633
1634X10 compatibility mode sends an escape sequence only on button press,
1635encoding the location and the mouse button pressed.  It is enabled by
1636specifying parameter 9 to DECSET.  On button press, xterm sends CSI M
1637CbCxCy (6 characters).
1638o Cb is button-1.
1639o Cx and Cy are the x and y coordinates of the mouse when the button was
1640  pressed.
1641Normal tracking mode
1642
1643Normal tracking mode sends an escape sequence on both button press and
1644release.  Modifier key (shift, ctrl, meta) information is also sent.  It
1645is enabled by specifying parameter 1000 to DECSET.  On button press or
1646release, xterm sends CSI M CbCxCy.
1647o The low two bits of Cb encode button information: 0=MB1 pressed, 1=MB2
1648  pressed, 2=MB3 pressed, 3=release.
1649o The next three bits encode the modifiers which were down when the but-
1650  ton was pressed and are added together:  4=Shift, 8=Meta, 16=Control.
1651  Note however that the shift and control bits are normally unavailable
1652  because xterm uses the control modifier with mouse for popup menus,
1653  and the shift modifier is used in the default translations for button
1654  events.  The Meta modifier recognized by xterm is the mod1 mask, and
1655  is not necessarily the "Meta" key (see xmodmap).
1656o Cx and Cy are the x and y coordinates of the mouse event, encoded as
1657  in X10 mode.
1658Wheel mice
1659
1660Wheel mice may return buttons 4 and 5.  Those buttons are represented by
1661the same event codes as buttons 1 and 2 respectively, except that 64 is
1662added to the event code.  Release events for the wheel buttons are not
1663reported.  By default, the wheel mouse events are translated to scroll-
1664back and scroll-forw actions.  Those actions normally scroll the whole
1665window, as if the scrollbar was used.  However if Alternate Scroll mode
1666is set, then cursor up/down controls are sent when the terminal is dis-
1667playing the alternate screen.  The initial state of Alternate Scroll
1668mode is set using the alternateScroll resource.
1669Highlight tracking
1670
1671Mouse highlight tracking notifies a program of a button press, receives
1672a range of lines from the program, highlights the region covered by the
1673mouse within that range until button release, and then sends the program
1674the release coordinates.  It is enabled by specifying parameter 1001 to
1675DECSET.  Highlighting is performed only for button 1, though other but-
1676ton events can be received.
1677
1678Warning: use of this mode requires a cooperating program or it will hang
1679xterm.
1680
1681On button press, the same information as for normal tracking is gener-
1682ated; xterm then waits for the program to send mouse tracking informa-
1683tion.  All X events are ignored until the proper escape sequence is
1684received from the pty: CSI Ps ; Ps ; Ps ; Ps ; Ps T .  The parameters
1685are func, startx, starty, firstrow, and lastrow.  func is non-zero to
1686initiate highlight tracking and zero to abort.  startx and starty give
1687the starting x and y location for the highlighted region.  The ending
1688location tracks the mouse, but will never be above row firstrow and will
1689always be above row lastrow.  (The top of the screen is row 1.)  When
1690the button is released, xterm reports the ending position one of two
1691ways:
1692o if the start and end coordinates are the same locations:
1693  CSI t CxCy.
1694o otherwise:
1695  CSI T CxCyCxCyCxCy.
1696  The parameters are startx, starty, endx, endy, mousex, and mousey.
1697  - startx, starty, endx, and endy give the starting and ending charac-
1698    ter positions of the region.
1699  - mousex and mousey give the location of the mouse at button up, which
1700    may not be over a character.
1701Button-event tracking
1702
1703Button-event tracking is essentially the same as normal tracking, but
1704xterm also reports button-motion events.  Motion events are reported
1705only if the mouse pointer has moved to a different character cell.  It
1706is enabled by specifying parameter 1002 to DECSET.  On button press or
1707release, xterm sends the same codes used by normal tracking mode.
1708o On button-motion events, xterm adds 32 to the event code (the third
1709  character, Cb).
1710o The other bits of the event code specify button and modifier keys as
1711  in normal mode.  For example, motion into cell x,y with button 1 down
1712  is reported as CSI M @ CxCy.  ( @  = 32 + 0 (button 1) + 32 (motion
1713  indicator) ).  Similarly, motion with button 3 down is reported as CSI
1714  M B CxCy.  ( B  = 32 + 2 (button 3) + 32 (motion indicator) ).
1715Any-event tracking
1716
1717Any-event mode is the same as button-event mode, except that all motion
1718events are reported, even if no mouse button is down.  It is enabled by
1719specifying 1003 to DECSET.
1720FocusIn/FocusOut
1721
1722FocusIn/FocusOut can be combined with any of the mouse events since it
1723uses a different protocol.  When set, it causes xterm to send CSI I
1724when the terminal gains focus, and CSI O  when it loses focus.
1725Extended coordinates
1726
1727The original X10 mouse protocol limits the Cx and Cy ordinates to 223
1728(=255 - 32).  Xterm supports more than one scheme for extending this
1729range, by changing the protocol encoding:
1730UTF-8 (1005)
1731          This enables UTF-8 encoding for Cx and Cy under all tracking
1732          modes, expanding the maximum encodable position from 223 to
1733          2015.  For positions less than 95, the resulting output is
1734          identical under both modes.  Under extended mouse mode, posi-
1735          tions greater than 95 generate "extra" bytes which will con-
1736          fuse applications which do not treat their input as a UTF-8
1737          stream.  Likewise, Cb will be UTF-8 encoded, to reduce confu-
1738          sion with wheel mouse events.
1739          Under normal mouse mode, positions outside (160,94) result in
1740          byte pairs which can be interpreted as a single UTF-8 charac-
1741          ter; applications which do treat their input as UTF-8 will
1742          almost certainly be confused unless extended mouse mode is
1743          active.
1744          This scheme has the drawback that the encoded coordinates will
1745          not pass through luit unchanged, e.g., for locales using non-
1746          UTF-8 encoding.
1747SGR (1006)
1748          The normal mouse response is altered to use CSI < followed by
1749          semicolon-separated encoded button value, the Cx and Cy ordi-
1750          nates and a final character which is M  for button press and m
1751          for button release.
1752          o The encoded button value in this case does not add 32 since
1753            that was useful only in the X10 scheme for ensuring that the
1754            byte containing the button value is a printable code.
1755          o The modifiers are encoded in the same way.
1756          o A different final character is used for button release to
1757            resolve the X10 ambiguity regarding which button was
1758            released.
1759          The highlight tracking responses are also modified to an SGR-
1760          like format, using the same SGR-style scheme and button-encod-
1761          ings.
1762URXVT (1015)
1763          The normal mouse response is altered to use CSI followed by
1764          semicolon-separated encoded button value, the Cx and Cy ordi-
1765          nates and final character M .
1766          This uses the same button encoding as X10, but printing it as
1767          a decimal integer rather than as a single byte.
1768          However, CSI M  can be mistaken for DL (delete lines), while
1769          the highlight tracking CSI T  can be mistaken for SD (scroll
1770          down), and the Window manipulation controls.  For these rea-
1771          sons, the 1015 control is not recommended; it is not an
1772          improvement over 1005.
1773
1774Sixel Graphics
1775If xterm is configured as VT240, VT241, VT330, VT340 or VT382 using the
1776decTerminalID resource, it supports Sixel Graphics controls, a palleted
1777bitmap graphics system using sets of six vertical pixels as the basic
1778element.
1779
1780CSI Ps c  xterm responds to Send Device Attributes (Primary DA) with
1781          these additional codes:
1782            Ps = 4  -> Sixel graphics.
1783CSI ? Pm h
1784          xterm has these additional private Set Mode values:
1785            Ps = 8 0  -> Sixel scrolling.
1786            Ps = 1 0 7 0  -> use private color registers for each
1787          graphic.
1788            Ps = 8 4 5 2  -> Sixel scrolling leaves cursor to right of
1789          graphic.
1790DCS Pa; Pb; Ph q  Ps..Ps ST
1791          See:
1792
1793               http://vt100.net/docs/vt3xx-gp/chapter14.html
1794
1795          The sixel data device control string has three positional
1796          parameters, following the q  with sixel data.
1797            Pa -> pixel aspect ratio
1798            Pb -> background color option
1799            Ph -> horizontal grid size (ignored).
1800            Ps -> sixel data
1801
1802ReGIS Graphics
1803If xterm is configured as VT125, VT240, VT241, VT330 or VT340 using the
1804decTerminalID resource, it supports Remote Graphic Instruction Set, a
1805graphics description language.
1806
1807CSI Ps c  xterm responds to Send Device Attributes (Primary DA) with
1808          these additional codes:
1809            Ps = 3  -> ReGIS graphics.
1810CSI ? Pm h
1811          xterm has these additional private Set Mode values:
1812            Ps = 1 0 7 0  -> use private color registers for each
1813          graphic.
1814DCS Pm p Pr..Pr ST
1815          See:
1816
1817               http://vt100.net/docs/vt3xx-gp/chapter1.html
1818
1819          The ReGIS data device control string has one positional param-
1820          eter with four possible values:
1821            Pm = 0 -> resume command, use fullscreen mode.
1822            Pm = 1 -> start new command, use fullscreen mode.
1823            Pm = 2 -> resume command, use command display mode.
1824            Pm = 3 -> start new command, use command display mode.
1825
1826Tektronix 4014 Mode
1827Most of these sequences are standard Tektronix 4014 control sequences.
1828Graph mode supports the 12-bit addressing of the Tektronix 4014.  The
1829major features missing are the write-through and defocused modes.  This
1830document does not describe the commands used in the various Tektronix
1831plotting modes but does describe the commands to switch modes.
1832
1833BEL       Bell (Ctrl-G).
1834BS        Backspace (Ctrl-H).
1835TAB       Horizontal Tab (Ctrl-I).
1836LF        Line Feed or New Line (Ctrl-J).
1837VT        Cursor up (Ctrl-K).
1838FF        Form Feed or New Page (Ctrl-L).
1839CR        Carriage Return (Ctrl-M).
1840ESC ETX   Switch to VT100 Mode (ESC  Ctrl-C).
1841ESC ENQ   Return Terminal Status (ESC  Ctrl-E).
1842ESC FF    PAGE (Clear Screen) (ESC  Ctrl-L).
1843ESC SO    Begin 4015 APL mode (ESC  Ctrl-N).  (This is ignored by
1844          xterm).
1845ESC SI    End 4015 APL mode (ESC  Ctrl-O).  (This is ignored by xterm).
1846ESC ETB   COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss).
1847            ETB  (end transmission block) is the same as Ctrl-W.
1848ESC CAN   Bypass Condition (ESC  Ctrl-X).
1849ESC SUB   GIN mode (ESC  Ctrl-Z).
1850ESC FS    Special Point Plot Mode (ESC  Ctrl-\).
1851ESC 8     Select Large Character Set.
1852ESC 9     Select #2 Character Set.
1853ESC :     Select #3 Character Set.
1854ESC ;     Select Small Character Set.
1855OSC Ps ; Pt BEL
1856          Set Text Parameters of VT window.
1857            Ps = 0  -> Change Icon Name and Window Title to Pt.
1858            Ps = 1  -> Change Icon Name to Pt.
1859            Ps = 2  -> Change Window Title to Pt.
1860            Ps = 4 6  -> Change Log File to Pt.  (This is normally dis-
1861          abled by a compile-time option).
1862ESC `     Normal Z Axis and Normal (solid) Vectors.
1863ESC a     Normal Z Axis and Dotted Line Vectors.
1864ESC b     Normal Z Axis and Dot-Dashed Vectors.
1865ESC c     Normal Z Axis and Short-Dashed Vectors.
1866ESC d     Normal Z Axis and Long-Dashed Vectors.
1867ESC h     Defocused Z Axis and Normal (solid) Vectors.
1868ESC i     Defocused Z Axis and Dotted Line Vectors.
1869ESC j     Defocused Z Axis and Dot-Dashed Vectors.
1870ESC k     Defocused Z Axis and Short-Dashed Vectors.
1871ESC l     Defocused Z Axis and Long-Dashed Vectors.
1872ESC p     Write-Thru Mode and Normal (solid) Vectors.
1873ESC q     Write-Thru Mode and Dotted Line Vectors.
1874ESC r     Write-Thru Mode and Dot-Dashed Vectors.
1875ESC s     Write-Thru Mode and Short-Dashed Vectors.
1876ESC t     Write-Thru Mode and Long-Dashed Vectors.
1877FS        Point Plot Mode (Ctrl-\).
1878GS        Graph Mode (Ctrl-]).
1879RS        Incremental Plot Mode (Ctrl-^).
1880US        Alpha Mode (Ctrl-_).
1881
1882VT52 Mode
1883Parameters for cursor movement are at the end of the ESC Y  escape
1884sequence.  Each ordinate is encoded in a single character as value+32.
1885For example, !  is 1.  The screen coordinate system is 0-based.
1886
1887ESC <     Exit VT52 mode (Enter VT100 mode).
1888ESC =     Enter alternate keypad mode.
1889ESC >     Exit alternate keypad mode.
1890ESC A     Cursor up.
1891ESC B     Cursor down.
1892ESC C     Cursor right.
1893ESC D     Cursor left.
1894ESC F     Enter graphics mode.
1895ESC G     Exit graphics mode.
1896ESC H     Move the cursor to the home position.
1897ESC I     Reverse line feed.
1898ESC J     Erase from the cursor to the end of the screen.
1899ESC K     Erase from the cursor to the end of the line.
1900ESC Y Ps Ps
1901          Move the cursor to given row and column.
1902ESC Z     Identify.
1903            -> ESC  /  Z  ("I am a VT52.").
1904