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