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