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