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