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