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