code / scripts

Lines748 Shell528 Python72 Lua67 Bourne Again Shell62 make15
1 others 4
Markdown4
(2.7K lines)
1 #!/usr/bin/less
3 XTerm Control Sequences
5 Edward Moy
6 University of California, Berkeley
8 Revised by
10 Stephen Gildea
11 X Consortium (1994)
13 Thomas Dickey
14 XFree86 Project (1996-2006)
15 invisible-island.net (2006-2019)
16 updated for XTerm Patch #347 (2019/05/28)
18 Definitions
20 c The literal character c.
22 C A single (required) character.
24 Ps A single (usually optional) numeric parameter, composed of one or
25 more digits.
27 Pm A multiple numeric parameter composed of any number of single
28 numeric parameters, separated by ; character(s). Individual val-
29 ues for the parameters are listed with Ps .
31 Pt A text parameter composed of printable characters.
33 Control Bytes, Characters, and Sequences
35 ECMA-48 (aka "ISO 6429") documents C1 (8-bit) and C0 (7-bit) codes.
36 Those are respectively codes 128 to 159 and 0 to 31. ECMA-48 avoids
37 referring to these codes as characters, because that term is associated
38 with graphic characters. Instead, it uses "bytes" and "codes", with
39 occasional lapses to "characters" where the meaning cannot be mistaken.
41 Controls (including the escape code 27) are processed once:
43 o This means that a C1 control can be mistaken for badly-formed UTF-8
44 when the terminal runs in UTF-8 mode because C1 controls are valid
45 continuation bytes of a UTF-8 encoded (multibyte) value.
47 o It is not possible to use a C1 control obtained from decoding the
48 UTF-8 text, because that would require reprocessing the data. Con-
49 sequently there is no ambiguity in the way this document uses the
50 term "character" to refer to bytes in a control sequence.
52 The order of processing is a necessary consequence of the way ECMA-48 is
53 designed:
55 o Each byte sent to the terminal can be unambiguously determined to
56 fall into one of a few categories (C0, C1 and graphic characters).
58 o ECMA-48 is modal; once it starts processing a control sequence, the
59 terminal continues until the sequence is complete, or some byte is
60 found which is not allowed in the sequence.
62 o Intermediate, parameter and final bytes may use the same codes as
63 graphic characters, but they are processed as part of a control
64 sequence and are not actually graphic characters.
66 o Eight-bit controls can have intermediate, etc., bytes in the range
67 160 to 255. Those can be treated as their counterparts in the range
68 32 to 127.
70 o Single-byte controls can be handled separately from multi-byte con-
71 trol sequences because ECMA-48's rules are unambiguous.
73 As a special case, ECMA-48 (section 9) mentions that the control
74 functions shift-in and shift-out are allowed to occur within a 7-bit
75 multibyte control sequence because those cannot alter the meaning of
76 the control sequence.
78 o Some controls (such as OSC ) introduce a string mode, which is ended
79 on a ST (string terminator).
81 ECMA-48 describes only correct behavior, telling what types of char-
82 acters are expected at each stage of the control sequences. It says
83 that the action taken in error recovery is implementation-dependent.
84 XTerm decodes control sequences using a state machine. It handles
85 errors in decoding i.e., unexpected characters, by resetting to the
86 initial (ground) state. That is different from the treatment of
87 unimplemented (but correctly formatted) features.
89 If an application does not send the string terminator, that is also
90 an error from the standpoint of a user. To accommodate users of
91 those applications, xterm has resource settings which allow work-
92 arounds:
94 o The Linux console's palette sequences do not use a string termi-
95 nator. The brokenLinuxOSC resource setting tells xterm to
96 ignore those particular sequences.
98 o The terminal should accept single-byte controls within the
99 string. But some applications omit a string terminator, like
100 the Linux console. The brokenStringTerm resource setting tells
101 xterm to exit string mode if it decodes a common control charac-
102 ter such as carriage return before the string terminator.
104 C1 (8-Bit) Control Characters
106 The xterm program recognizes both 8-bit and 7-bit control characters.
107 It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled.
108 The following pairs of 7-bit and 8-bit control characters are equiva-
109 lent:
111 ESC D
112 Index (IND is 0x84).
114 ESC E
115 Next Line (NEL is 0x85).
117 ESC H
118 Tab Set (HTS is 0x88).
120 ESC M
121 Reverse Index (RI is 0x8d).
123 ESC N
124 Single Shift Select of G2 Character Set (SS2 is 0x8e), VT220.
125 This affects next character only.
127 ESC O
128 Single Shift Select of G3 Character Set (SS3 is 0x8f), VT220.
129 This affects next character only.
131 ESC P
132 Device Control String (DCS is 0x90).
134 ESC V
135 Start of Guarded Area (SPA is 0x96).
137 ESC W
138 End of Guarded Area (EPA is 0x97).
140 ESC X
141 Start of String (SOS is 0x98).
143 ESC Z
144 Return Terminal ID (DECID is 0x9a). Obsolete form of CSI c (DA).
146 ESC [
147 Control Sequence Introducer (CSI is 0x9b).
149 ESC \
150 String Terminator (ST is 0x9c).
152 ESC ]
153 Operating System Command (OSC is 0x9d).
155 ESC ^
156 Privacy Message (PM is 0x9e).
158 ESC _
159 Application Program Command (APC is 0x9f).
161 These control characters are used in the vtXXX emulation.
163 VT100 Mode
165 In this document, "VT100" refers not only to VT100/VT102, but also to
166 the succession of upward-compatible terminals produced by DEC (Digital
167 Equipment Corporation) from the mid-1970s for about twenty years. For
168 brevity, the document refers to the related models:
169 "VT200" as VT220/VT240,
170 "VT300" as VT320/VT340,
171 "VT400" as VT420, and
172 "VT500" as VT510/VT520/VT525.
174 Most of these control sequences are standard VT102 control sequences,
175 but there is support for later DEC VT terminals (i.e., VT220, VT320,
176 VT420, VT510), as well as ECMA-48 and aixterm color controls. The only
177 VT102 feature not supported is auto-repeat, since the only way X pro-
178 vides for this will affect all windows.
180 There are additional control sequences to provide xterm-dependent func-
181 tions, such as the scrollbar or window size. Where the function is
182 specified by DEC or ECMA-48, the code assigned to it is given in paren-
183 theses.
185 The escape codes to designate and invoke character sets are specified by
186 ISO 2022 (see that document for a discussion of character sets).
188 Many of the features are optional; xterm can be configured and built
189 without support for them.
191 Single-character functions
193 BEL Bell (Ctrl-G).
195 BS Backspace (Ctrl-H).
197 CR Carriage Return (Ctrl-M).
199 ENQ Return Terminal Status (Ctrl-E). Default response is an empty
200 string, but may be overridden by a resource answerbackString.
202 FF Form Feed or New Page (NP). (FF is Ctrl-L). FF is treated
203 the same as LF .
205 LF Line Feed or New Line (NL). (LF is Ctrl-J).
207 SI Switch to Standard Character Set (Ctrl-O is Shift In or LS0).
208 This invokes the G0 character set (the default) as GL.
209 VT200 and up implement LS0.
211 SO Switch to Alternate Character Set (Ctrl-N is Shift Out or
212 LS1). This invokes the G1 character set as GL.
213 VT200 and up implement LS1.
215 SP Space.
217 TAB Horizontal Tab (HT) (Ctrl-I).
219 VT Vertical Tab (Ctrl-K). This is treated the same as LF.
221 Controls beginning with ESC
223 This excludes controls where ESC is part of a 7-bit equivalent to 8-bit
224 C1 controls, ordered by the final character(s).
226 ESC SP F 7-bit controls (S7C1T), VT220. This tells the terminal to
227 send C1 control characters as 7-bit sequences, e.g., its
228 responses to queries. DEC VT200 and up always accept 8-bit
229 control sequences except when configured for VT100 mode.
231 ESC SP G 8-bit controls (S8C1T), VT220. This tells the terminal to
232 send C1 control characters as 8-bit sequences, e.g., its
233 responses to queries. DEC VT200 and up always accept 8-bit
234 control sequences except when configured for VT100 mode.
236 ESC SP L Set ANSI conformance level 1 (dpANS X3.134.1).
238 ESC SP M Set ANSI conformance level 2 (dpANS X3.134.1).
240 ESC SP N Set ANSI conformance level 3 (dpANS X3.134.1).
242 ESC # 3 DEC double-height line, top half (DECDHL), VT100.
244 ESC # 4 DEC double-height line, bottom half (DECDHL), VT100.
246 ESC # 5 DEC single-width line (DECSWL), VT100.
248 ESC # 6 DEC double-width line (DECDWL), VT100.
250 ESC # 8 DEC Screen Alignment Test (DECALN), VT100.
252 ESC % @ Select default character set. That is ISO 8859-1 (ISO 2022).
254 ESC % G Select UTF-8 character set, ISO 2022.
256 ESC ( C Designate G0 Character Set, VT100, ISO 2022.
257 Final character C for designating 94-character sets. In this
258 list,
259 o 0 , A and B were introduced in the VT100,
260 o most were introduced in the VT200 series,
261 o a few were introduced in the VT300 series, and
262 o a few more were introduced in the VT500 series.
263 The VT220 character sets, together with a few others (such as
264 Portuguese) are activated by the National Replacement Charac-
265 ter Set (NRCS) controls. The term "replacement" says that the
266 character set is formed by replacing some of the characters in
267 a set (termed the Multinational Character Set) with more use-
268 ful ones for a given language. The ASCII and DEC Supplemental
269 character sets make up the two halves of the Multinational
270 Character set, initially mapped to GL and GR.
271 The valid final characters C for this control are:
272 C = A -> United Kingdom (UK), VT100.
273 C = B -> United States (USASCII), VT100.
274 C = 4 -> Dutch, VT200.
275 C = C or 5 -> Finnish, VT200.
276 C = R or f -> French, VT200.
277 C = Q or 9 -> French Canadian, VT200.
278 C = K -> German, VT200.
279 C = " > -> Greek, VT500.
280 C = % = -> Hebrew, VT500.
281 C = Y -> Italian, VT200.
282 C = ` , E or 6 -> Norwegian/Danish, VT200.
283 C = % 6 -> Portuguese, VT300.
284 C = Z -> Spanish, VT200.
285 C = H or 7 -> Swedish, VT200.
286 C = = -> Swiss, VT200.
287 C = % 2 -> Turkish, VT500.
288 The final character A is a special case, since the same final
289 character is used by the VT300-control for the 96-character
290 British Latin-1.
291 There are a few other 94-character sets:
292 C = 0 -> DEC Special Character and Line Drawing Set, VT100.
293 C = < -> DEC Supplemental, VT200.
294 C = > -> DEC Technical, VT300.
295 These are documented as NRCS:
296 C = % 5 -> DEC Supplemental Graphics, VT300.
297 C = & 4 -> DEC Cyrillic, VT500.
298 C = " ? -> DEC Greek, VT500.
299 C = " 4 -> DEC Hebrew, VT500.
300 C = % 0 -> DEC Turkish, VT500.
301 The VT520 reference manual lists a few more, but no documenta-
302 tion has been found for the mappings:
303 C = & 5 -> DEC Russian, VT500.
304 C = % 3 -> SCS NRCS, VT500.
306 ESC ) C Designate G1 Character Set, ISO 2022, VT100.
307 The same character sets apply as for ESC ( C.
309 ESC * C Designate G2 Character Set, ISO 2022, VT220.
310 The same character sets apply as for ESC ( C.
312 ESC + C Designate G3 Character Set, ISO 2022, VT220.
313 The same character sets apply as for ESC ( C.
315 ESC - C Designate G1 Character Set, VT300.
316 These controls apply only to 96-character sets. Unlike the
317 94-character sets, these can have different values than ASCII
318 space and DEL for the mapping of 0x20 and 0x7f. The valid
319 final characters C for this control are:
320 C = A -> ISO Latin-1 Supplemental (VT300).
321 C = F -> ISO Greek Supplemental (VT500).
322 C = H -> ISO Hebrew Supplemental (VT500).
323 C = L -> ISO Latin-Cyrillic (VT500).
324 C = M -> ISO Latin-5 Supplemental (VT500).
326 ESC . C Designate G2 Character Set, VT300.
327 The same character sets apply as for ESC - C.
329 ESC / C Designate G3 Character Set, VT300.
330 The same character sets apply as for ESC - C.
332 ESC 6 Back Index (DECBI), VT420 and up.
334 ESC 7 Save Cursor (DECSC), VT100.
336 ESC 8 Restore Cursor (DECRC), VT100.
338 ESC 9 Forward Index (DECFI), VT420 and up.
340 ESC = Application Keypad (DECKPAM).
342 ESC > Normal Keypad (DECKPNM), VT100.
344 ESC F Cursor to lower left corner of screen. This is enabled by the
345 hpLowerleftBugCompat resource.
347 ESC c Full Reset (RIS), VT100.
349 ESC l Memory Lock (per HP terminals). Locks memory above the cur-
350 sor.
352 ESC m Memory Unlock (per HP terminals).
354 ESC n Invoke the G2 Character Set as GL (LS2) as GL.
356 ESC o Invoke the G3 Character Set as GL (LS3) as GL.
358 ESC | Invoke the G3 Character Set as GR (LS3R).
360 ESC } Invoke the G2 Character Set as GR (LS2R).
362 ESC ~ Invoke the G1 Character Set as GR (LS1R), VT100.
364 Application Program-Command functions
366 APC Pt ST None. xterm implements no APC functions; Pt is ignored. Pt
367 need not be printable characters.
369 Device-Control functions
371 DCS Ps ; Ps | Pt ST
372 User-Defined Keys (DECUDK), VT220 and up.
374 The first parameter:
375 Ps = 0 -> Clear all UDK definitions before starting
376 (default).
377 Ps = 1 -> Erase Below (default).
379 The second parameter:
380 Ps = 0 <- Lock the keys (default).
381 Ps = 1 <- Do not lock.
383 The third parameter is a ';'-separated list of strings denot-
384 ing the key-code separated by a '/' from the hex-encoded key
385 value. The key codes correspond to the DEC function-key codes
386 (e.g., F6=17).
388 DCS $ q Pt ST
389 Request Status String (DECRQSS), VT420 and up.
390 The string following the "q" is one of the following:
391 m -> SGR
392 " p -> DECSCL
393 SP q -> DECSCUSR
394 " q -> DECSCA
395 r -> DECSTBM
396 s -> DECSLRM
397 t -> DECSLPP
398 $ | -> DECSCPP
399 * | -> DECSNLS
400 xterm responds with DCS 1 $ r Pt ST for valid requests,
401 replacing the Pt with the corresponding CSI string, or DCS 0 $
402 r Pt ST for invalid requests.
404 DCS Ps $ t Pt ST
405 Restore presentation status (DECRSPS), VT320 and up. The con-
406 trol can be converted from a response from DECCIR or DECTABSR
407 by changing the first "u" to a "t"
408 Ps = 1 -> DECCIR
409 Ps = 2 -> DECTABSR
411 DCS + p Pt ST
412 Set Termcap/Terminfo Data (xterm). The string following the
413 "p" is a name to use for retrieving data from the terminal
414 database. The data will be used for the "tcap" keyboard con-
415 figuration's function- and special-keys, as well as by the
416 Request Termcap/Terminfo String control.
418 DCS + q Pt ST
419 Request Termcap/Terminfo String (xterm). The string following
420 the "q" is a list of names encoded in hexadecimal (2 digits
421 per character) separated by ; which correspond to termcap or
422 terminfo key names.
423 A few special features are also recognized, which are not key
424 names:
425 o Co for termcap colors (or colors for terminfo colors), and
426 o TN for termcap name (or name for terminfo name).
427 o RGB for the ncurses direct-color extension.
428 Only a terminfo name is provided, since termcap applica-
429 tions cannot use this information.
430 xterm responds with
431 DCS 1 + r Pt ST for valid requests, adding to Pt an = , and
432 the value of the corresponding string that xterm would send,
434 DCS 0 + r Pt ST for invalid requests.
435 The strings are encoded in hexadecimal (2 digits per charac-
436 ter).
438 Functions using CSI , ordered by the final character(s)
440 CSI Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH).
442 CSI Ps SP @
443 Shift left Ps columns(s) (default = 1) (SL), ECMA-48.
445 CSI Ps A Cursor Up Ps Times (default = 1) (CUU).
447 CSI Ps SP A
448 Shift right Ps columns(s) (default = 1) (SR), ECMA-48.
450 CSI Ps B Cursor Down Ps Times (default = 1) (CUD).
452 CSI Ps C Cursor Forward Ps Times (default = 1) (CUF).
454 CSI Ps D Cursor Backward Ps Times (default = 1) (CUB).
456 CSI Ps E Cursor Next Line Ps Times (default = 1) (CNL).
458 CSI Ps F Cursor Preceding Line Ps Times (default = 1) (CPL).
460 CSI Ps G Cursor Character Absolute [column] (default = [row,1]) (CHA).
462 CSI Ps ; Ps H
463 Cursor Position [row;column] (default = [1,1]) (CUP).
465 CSI Ps I Cursor Forward Tabulation Ps tab stops (default = 1) (CHT).
467 CSI Ps J Erase in Display (ED), VT100.
468 Ps = 0 -> Erase Below (default).
469 Ps = 1 -> Erase Above.
470 Ps = 2 -> Erase All.
471 Ps = 3 -> Erase Saved Lines (xterm).
473 CSI ? Ps J
474 Erase in Display (DECSED), VT220.
475 Ps = 0 -> Selective Erase Below (default).
476 Ps = 1 -> Selective Erase Above.
477 Ps = 2 -> Selective Erase All.
478 Ps = 3 -> Selective Erase Saved Lines (xterm).
480 CSI Ps K Erase in Line (EL), VT100.
481 Ps = 0 -> Erase to Right (default).
482 Ps = 1 -> Erase to Left.
483 Ps = 2 -> Erase All.
485 CSI ? Ps K
486 Erase in Line (DECSEL), VT220.
487 Ps = 0 -> Selective Erase to Right (default).
488 Ps = 1 -> Selective Erase to Left.
489 Ps = 2 -> Selective Erase All.
491 CSI Ps L Insert Ps Line(s) (default = 1) (IL).
493 CSI Ps M Delete Ps Line(s) (default = 1) (DL).
495 CSI Ps P Delete Ps Character(s) (default = 1) (DCH).
497 CSI Ps S Scroll up Ps lines (default = 1) (SU), VT420, ECMA-48.
499 CSI ? Pi ; Pa ; Pv S
500 If configured to support either Sixel Graphics or ReGIS Graph-
501 ics, xterm accepts a three-parameter control sequence, where
502 Pi, Pa and Pv are the item, action and value:
504 Pi = 1 -> item is number of color registers.
505 Pi = 2 -> item is Sixel graphics geometry (in pixels).
506 Pi = 3 -> item is ReGIS graphics geometry (in pixels).
508 Pa = 1 -> read
509 Pa = 2 -> reset to default
510 Pa = 3 -> set to value in Pv
511 Pa = 4 -> read the maximum allowed value
513 Pv can be omitted except when setting (Pa == 3 ).
514 Pv = n <- A single integer is used for color registers.
515 Pv = width ; height <- Two integers for graphics geometry.
517 xterm replies with a control sequence of the same form:
519 CSI ? Pi ; Ps ; Pv S
521 where Ps is the status:
522 Ps = 0 -> success.
523 Ps = 1 -> error in Pi.
524 Ps = 2 -> error in Pa.
525 Ps = 3 -> failure.
527 On success, Pv represents the value read or set.
529 Notes:
530 o The current implementation allows reading the graphics
531 sizes, but disallows modifying those sizes because that is
532 done once, using resource-values.
533 o Graphics geometry is not necessarily the same as "window
534 size" (see the dtterm window manipulation extensions).
535 For example, xterm limits the maximum graphics geometry at
536 compile time (1000x1000 as of version 328) although the
537 window size can be larger.
538 o While resizing a window will always change the current
539 graphics geometry, the reverse is not true. Setting
540 graphics geometry does not affect the window size.
542 CSI Ps T Scroll down Ps lines (default = 1) (SD), VT420.
544 CSI Ps ; Ps ; Ps ; Ps ; Ps T
545 Initiate highlight mouse tracking. Parameters are
546 [func;startx;starty;firstrow;lastrow]. See the section Mouse
547 Tracking.
549 CSI > Ps ; Ps T
550 Reset one or more features of the title modes to the default
551 value. Normally, "reset" disables the feature. It is possi-
552 ble to disable the ability to reset features by compiling a
553 different default for the title modes into xterm.
555 Ps = 0 -> Do not set window/icon labels using hexadecimal.
556 Ps = 1 -> Do not query window/icon labels using hexadeci-
557 mal.
558 Ps = 2 -> Do not set window/icon labels using UTF-8.
559 Ps = 3 -> Do not query window/icon labels using UTF-8.
561 (See discussion of Title Modes).
563 CSI Ps X Erase Ps Character(s) (default = 1) (ECH).
565 CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT).
567 CSI Ps ^ Scroll down Ps lines (default = 1) (SD), ECMA-48.
568 This is probably an error in ECMA-48, because the standard
569 writes codes as pairs of decimal values, and this is "14" ver-
570 sus the VT420 "4".
572 CSI Pm ` Character Position Absolute [column] (default = [row,1])
573 (HPA).
575 CSI Pm a Character Position Relative [columns] (default = [row,col+1])
576 (HPR).
578 CSI Ps b Repeat the preceding graphic character Ps times (REP).
580 CSI Ps c Send Device Attributes (Primary DA).
581 Ps = 0 or omitted -> request attributes from terminal. The
582 response depends on the decTerminalID resource setting.
583 -> CSI ? 1 ; 2 c ("VT100 with Advanced Video Option")
584 -> CSI ? 1 ; 0 c ("VT101 with No Options")
585 -> CSI ? 6 c ("VT102")
586 -> CSI ? 6 2 ; Psc ("VT220")
587 -> CSI ? 6 3 ; Psc ("VT320")
588 -> CSI ? 6 4 ; Psc ("VT420")
590 The VT100-style response parameters do not mean anything by
591 themselves. VT220 (and higher) parameters do, telling the
592 host what features the terminal supports:
593 Ps = 1 -> 132-columns.
594 Ps = 2 -> Printer.
595 Ps = 3 -> ReGIS graphics.
596 Ps = 4 -> Sixel graphics.
597 Ps = 6 -> Selective erase.
598 Ps = 8 -> User-defined keys.
599 Ps = 9 -> National Replacement Character sets.
600 Ps = 1 5 -> Technical characters.
601 Ps = 1 8 -> User windows.
602 Ps = 2 1 -> Horizontal scrolling.
603 Ps = 2 2 -> ANSI color, e.g., VT525.
604 Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode).
606 CSI = Ps c
607 Send Device Attributes (Tertiary DA).
608 Ps = 0 -> report Terminal Unit ID (default), VT400. XTerm
609 uses zeros for the site code and serial number in its DECRPTUI
610 response.
612 CSI > Ps c
613 Send Device Attributes (Secondary DA).
614 Ps = 0 or omitted -> request the terminal's identification
615 code. The response depends on the decTerminalID resource set-
616 ting. It should apply only to VT220 and up, but xterm extends
617 this to VT100.
618 -> CSI > Pp ; Pv ; Pc c
619 where Pp denotes the terminal type
620 Pp = 0 -> "VT100".
621 Pp = 1 -> "VT220".
622 Pp = 2 -> "VT240".
623 Pp = 1 8 -> "VT330".
624 Pp = 1 9 -> "VT340".
625 Pp = 2 4 -> "VT320".
626 Pp = 4 1 -> "VT420".
627 Pp = 6 1 -> "VT510".
628 Pp = 6 4 -> "VT520".
629 Pp = 6 5 -> "VT525".
631 and Pv is the firmware version (for xterm, this was originally
632 the XFree86 patch number, starting with 95). In a DEC termi-
633 nal, Pc indicates the ROM cartridge registration number and is
634 always zero.
636 CSI Pm d Line Position Absolute [row] (default = [1,column]) (VPA).
638 CSI Pm e Line Position Relative [rows] (default = [row+1,column])
639 (VPR).
641 CSI Ps ; Ps f
642 Horizontal and Vertical Position [row;column] (default =
643 [1,1]) (HVP).
645 CSI Ps g Tab Clear (TBC).
646 Ps = 0 -> Clear Current Column (default).
647 Ps = 3 -> Clear All.
649 CSI Pm h Set Mode (SM).
650 Ps = 2 -> Keyboard Action Mode (AM).
651 Ps = 4 -> Insert Mode (IRM).
652 Ps = 1 2 -> Send/receive (SRM).
653 Ps = 2 0 -> Automatic Newline (LNM).
655 CSI ? Pm h
656 DEC Private Mode Set (DECSET).
657 Ps = 1 -> Application Cursor Keys (DECCKM), VT100.
658 Ps = 2 -> Designate USASCII for character sets G0-G3
659 (DECANM), VT100, and set VT100 mode.
660 Ps = 3 -> 132 Column Mode (DECCOLM), VT100.
661 Ps = 4 -> Smooth (Slow) Scroll (DECSCLM), VT100.
662 Ps = 5 -> Reverse Video (DECSCNM), VT100.
663 Ps = 6 -> Origin Mode (DECOM), VT100.
664 Ps = 7 -> Auto-wrap Mode (DECAWM), VT100.
665 Ps = 8 -> Auto-repeat Keys (DECARM), VT100.
666 Ps = 9 -> Send Mouse X & Y on button press. See the sec-
667 tion Mouse Tracking. This is the X10 xterm mouse protocol.
668 Ps = 1 0 -> Show toolbar (rxvt).
669 Ps = 1 2 -> Start Blinking Cursor (AT&T 610).
670 Ps = 1 3 -> Start Blinking Cursor (set only via resource or
671 menu).
672 Ps = 1 4 -> Enable XOR of Blinking Cursor control sequence
673 and menu.
674 Ps = 1 8 -> Print form feed (DECPFF), VT220.
675 Ps = 1 9 -> Set print extent to full screen (DECPEX),
676 VT220.
677 Ps = 2 5 -> Show Cursor (DECTCEM), VT220.
678 Ps = 3 0 -> Show scrollbar (rxvt).
679 Ps = 3 5 -> Enable font-shifting functions (rxvt).
680 Ps = 3 8 -> Enter Tektronix Mode (DECTEK), VT240, xterm.
681 Ps = 4 0 -> Allow 80 -> 132 Mode, xterm.
682 Ps = 4 1 -> more(1) fix (see curses resource).
683 Ps = 4 2 -> Enable National Replacement Character sets
684 (DECNRCM), VT220.
685 Ps = 4 4 -> Turn On Margin Bell, xterm.
686 Ps = 4 5 -> Reverse-wraparound Mode, xterm.
687 Ps = 4 6 -> Start Logging, xterm. This is normally dis-
688 abled by a compile-time option.
689 Ps = 4 7 -> Use Alternate Screen Buffer, xterm. This may
690 be disabled by the titeInhibit resource.
691 Ps = 6 6 -> Application keypad (DECNKM), VT320.
692 Ps = 6 7 -> Backarrow key sends backspace (DECBKM), VT340,
693 VT420.
694 Ps = 6 9 -> Enable left and right margin mode (DECLRMM),
695 VT420 and up.
696 Ps = 9 5 -> Do not clear screen when DECCOLM is set/reset
697 (DECNCSM), VT510 and up.
698 Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
699 release. See the section Mouse Tracking. This is the X11
700 xterm mouse protocol.
701 Ps = 1 0 0 1 -> Use Hilite Mouse Tracking, xterm.
702 Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking, xterm.
703 Ps = 1 0 0 3 -> Use All Motion Mouse Tracking, xterm.
704 Ps = 1 0 0 4 -> Send FocusIn/FocusOut events, xterm.
705 Ps = 1 0 0 5 -> Enable UTF-8 Mouse Mode, xterm.
706 Ps = 1 0 0 6 -> Enable SGR Mouse Mode, xterm.
707 Ps = 1 0 0 7 -> Enable Alternate Scroll Mode, xterm. This
708 corresponds to the alternateScroll resource.
709 Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt).
710 Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt).
711 Ps = 1 0 1 5 -> Enable urxvt Mouse Mode.
712 Ps = 1 0 3 4 -> Interpret "meta" key, xterm. This sets
713 eighth bit of keyboard input (and enables the eightBitInput
714 resource).
715 Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num-
716 Lock keys, xterm. This enables the numLock resource.
717 Ps = 1 0 3 6 -> Send ESC when Meta modifies a key, xterm.
718 This enables the metaSendsEscape resource.
719 Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete
720 key, xterm.
721 Ps = 1 0 3 9 -> Send ESC when Alt modifies a key, xterm.
722 This enables the altSendsEscape resource, xterm.
723 Ps = 1 0 4 0 -> Keep selection even if not highlighted,
724 xterm. This enables the keepSelection resource.
725 Ps = 1 0 4 1 -> Use the CLIPBOARD selection, xterm. This
726 enables the selectToClipboard resource.
727 Ps = 1 0 4 2 -> Enable Urgency window manager hint when
728 Control-G is received, xterm. This enables the bellIsUrgent
729 resource.
730 Ps = 1 0 4 3 -> Enable raising of the window when Control-G
731 is received, xterm. This enables the popOnBell resource.
732 Ps = 1 0 4 4 -> Reuse the most recent data copied to CLIP-
733 BOARD, xterm. This enables the keepClipboard resource.
734 Ps = 1 0 4 6 -> Enable switching to/from Alternate Screen
735 Buffer, xterm. This works for terminfo-based systems, updat-
736 ing the titeInhibit resource.
737 Ps = 1 0 4 7 -> Use Alternate Screen Buffer, xterm. This
738 may be disabled by the titeInhibit resource.
739 Ps = 1 0 4 8 -> Save cursor as in DECSC, xterm. This may
740 be disabled by the titeInhibit resource.
741 Ps = 1 0 4 9 -> Save cursor as in DECSC, xterm. After sav-
742 ing the cursor, switch to the Alternate Screen Buffer, clear-
743 ing it first. This may be disabled by the titeInhibit
744 resource. This control combines the effects of the 1 0 4 7
745 and 1 0 4 8 modes. Use this with terminfo-based applications
746 rather than the 4 7 mode.
747 Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode,
748 xterm.
749 Ps = 1 0 5 1 -> Set Sun function-key mode, xterm.
750 Ps = 1 0 5 2 -> Set HP function-key mode, xterm.
751 Ps = 1 0 5 3 -> Set SCO function-key mode, xterm.
752 Ps = 1 0 6 0 -> Set legacy keyboard emulation (i.e, X11R6),
753 xterm.
754 Ps = 1 0 6 1 -> Set VT220 keyboard emulation, xterm.
755 Ps = 2 0 0 4 -> Set bracketed paste mode, xterm.
757 CSI Pm i Media Copy (MC).
758 Ps = 0 -> Print screen (default).
759 Ps = 4 -> Turn off printer controller mode.
760 Ps = 5 -> Turn on printer controller mode.
761 Ps = 1 0 -> HTML screen dump, xterm.
762 Ps = 1 1 -> SVG screen dump, xterm.
764 CSI ? Pm i
765 Media Copy (MC), DEC-specific.
766 Ps = 1 -> Print line containing cursor.
767 Ps = 4 -> Turn off autoprint mode.
768 Ps = 5 -> Turn on autoprint mode.
769 Ps = 1 0 -> Print composed display, ignores DECPEX.
770 Ps = 1 1 -> Print all pages.
772 CSI Pm l Reset Mode (RM).
773 Ps = 2 -> Keyboard Action Mode (AM).
774 Ps = 4 -> Replace Mode (IRM).
775 Ps = 1 2 -> Send/receive (SRM).
776 Ps = 2 0 -> Normal Linefeed (LNM).
778 CSI ? Pm l
779 DEC Private Mode Reset (DECRST).
780 Ps = 1 -> Normal Cursor Keys (DECCKM), VT100.
781 Ps = 2 -> Designate VT52 mode (DECANM), VT100.
782 Ps = 3 -> 80 Column Mode (DECCOLM), VT100.
783 Ps = 4 -> Jump (Fast) Scroll (DECSCLM), VT100.
784 Ps = 5 -> Normal Video (DECSCNM), VT100.
785 Ps = 6 -> Normal Cursor Mode (DECOM), VT100.
786 Ps = 7 -> No Auto-wrap Mode (DECAWM), VT100.
787 Ps = 8 -> No Auto-repeat Keys (DECARM), VT100.
788 Ps = 9 -> Don't send Mouse X & Y on button press, xterm.
789 Ps = 1 0 -> Hide toolbar (rxvt).
790 Ps = 1 2 -> Stop Blinking Cursor (AT&T 610).
791 Ps = 1 3 -> Disable Blinking Cursor (reset only via
792 resource or menu).
793 Ps = 1 4 -> Disable XOR of Blinking Cursor control sequence
794 and menu.
795 Ps = 1 8 -> Don't print form feed (DECPFF).
796 Ps = 1 9 -> Limit print to scrolling region (DECPEX).
797 Ps = 2 5 -> Hide Cursor (DECTCEM), VT220.
798 Ps = 3 0 -> Don't show scrollbar (rxvt).
799 Ps = 3 5 -> Disable font-shifting functions (rxvt).
800 Ps = 4 0 -> Disallow 80 -> 132 Mode, xterm.
801 Ps = 4 1 -> No more(1) fix (see curses resource).
802 Ps = 4 2 -> Disable National Replacement Character sets
803 (DECNRCM), VT220.
804 Ps = 4 4 -> Turn Off Margin Bell, xterm.
805 Ps = 4 5 -> No Reverse-wraparound Mode, xterm.
806 Ps = 4 6 -> Stop Logging, xterm. This is normally disabled
807 by a compile-time option.
808 Ps = 4 7 -> Use Normal Screen Buffer, xterm.
809 Ps = 6 6 -> Numeric keypad (DECNKM), VT320.
810 Ps = 6 7 -> Backarrow key sends delete (DECBKM), VT340,
811 VT420.
812 Ps = 6 9 -> Disable left and right margin mode (DECLRMM),
813 VT420 and up.
814 Ps = 9 5 -> Clear screen when DECCOLM is set/reset (DEC-
815 NCSM), VT510 and up.
816 Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and
817 release. See the section Mouse Tracking.
818 Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking, xterm.
819 Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking,
820 xterm.
821 Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking, xterm.
822 Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events, xterm.
823 Ps = 1 0 0 5 -> Disable UTF-8 Mouse Mode, xterm.
824 Ps = 1 0 0 6 -> Disable SGR Mouse Mode, xterm.
825 Ps = 1 0 0 7 -> Disable Alternate Scroll Mode, xterm. This
826 corresponds to the alternateScroll resource.
827 Ps = 1 0 1 0 -> Don't scroll to bottom on tty output
828 (rxvt).
829 Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt).
830 Ps = 1 0 1 5 -> Disable urxvt Mouse Mode.
831 Ps = 1 0 3 4 -> Don't interpret "meta" key, xterm. This
832 disables the eightBitInput resource.
833 Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num-
834 Lock keys, xterm. This disables the numLock resource.
835 Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key,
836 xterm. This disables the metaSendsEscape resource.
837 Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad
838 Delete key, xterm.
839 Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key,
840 xterm. This disables the altSendsEscape resource.
841 Ps = 1 0 4 0 -> Do not keep selection when not highlighted,
842 xterm. This disables the keepSelection resource.
843 Ps = 1 0 4 1 -> Use the PRIMARY selection, xterm. This
844 disables the selectToClipboard resource.
845 Ps = 1 0 4 2 -> Disable Urgency window manager hint when
846 Control-G is received, xterm. This disables the bellIsUrgent
847 resource.
848 Ps = 1 0 4 3 -> Disable raising of the window when Control-
849 G is received, xterm. This disables the popOnBell resource.
850 Ps = 1 0 4 6 -> Disable switching to/from Alternate Screen
851 Buffer, xterm. This works for terminfo-based systems, updat-
852 ing the titeInhibit resource. If currently using the Alter-
853 nate Screen Buffer, xterm switches to the Normal Screen Buf-
854 fer.
855 Ps = 1 0 4 7 -> Use Normal Screen Buffer, xterm. Clear the
856 screen first if in the Alternate Screen Buffer. This may be
857 disabled by the titeInhibit resource.
858 Ps = 1 0 4 8 -> Restore cursor as in DECRC, xterm. This
859 may be disabled by the titeInhibit resource.
860 Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor
861 as in DECRC, xterm. This may be disabled by the titeInhibit
862 resource. This combines the effects of the 1 0 4 7 and 1 0 4
863 8 modes. Use this with terminfo-based applications rather
864 than the 4 7 mode.
865 Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode,
866 xterm.
867 Ps = 1 0 5 1 -> Reset Sun function-key mode, xterm.
868 Ps = 1 0 5 2 -> Reset HP function-key mode, xterm.
869 Ps = 1 0 5 3 -> Reset SCO function-key mode, xterm.
870 Ps = 1 0 6 0 -> Reset legacy keyboard emulation (i.e,
871 X11R6), xterm.
872 Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style,
873 xterm.
874 Ps = 2 0 0 4 -> Reset bracketed paste mode, xterm.
876 CSI Pm m Character Attributes (SGR).
877 Ps = 0 -> Normal (default), VT100.
878 Ps = 1 -> Bold, VT100.
879 Ps = 2 -> Faint, decreased intensity, ECMA-48 2nd.
880 Ps = 3 -> Italicized, ECMA-48 2nd.
881 Ps = 4 -> Underlined, VT100.
882 Ps = 5 -> Blink, VT100.
883 This appears as Bold in X11R6 xterm.
884 Ps = 7 -> Inverse, VT100.
885 Ps = 8 -> Invisible, i.e., hidden, ECMA-48 2nd, VT300.
886 Ps = 9 -> Crossed-out characters, ECMA-48 3rd.
887 Ps = 2 1 -> Doubly-underlined, ECMA-48 3rd.
888 Ps = 2 2 -> Normal (neither bold nor faint), ECMA-48 3rd.
889 Ps = 2 3 -> Not italicized, ECMA-48 3rd.
890 Ps = 2 4 -> Not underlined, ECMA-48 3rd.
891 Ps = 2 5 -> Steady (not blinking), ECMA-48 3rd.
892 Ps = 2 7 -> Positive (not inverse), ECMA-48 3rd.
893 Ps = 2 8 -> Visible, i.e., not hidden, ECMA-48 3rd, VT300.
894 Ps = 2 9 -> Not crossed-out, ECMA-48 3rd.
895 Ps = 3 0 -> Set foreground color to Black.
896 Ps = 3 1 -> Set foreground color to Red.
897 Ps = 3 2 -> Set foreground color to Green.
898 Ps = 3 3 -> Set foreground color to Yellow.
899 Ps = 3 4 -> Set foreground color to Blue.
900 Ps = 3 5 -> Set foreground color to Magenta.
901 Ps = 3 6 -> Set foreground color to Cyan.
902 Ps = 3 7 -> Set foreground color to White.
903 Ps = 3 9 -> Set foreground color to default, ECMA-48 3rd.
904 Ps = 4 0 -> Set background color to Black.
905 Ps = 4 1 -> Set background color to Red.
906 Ps = 4 2 -> Set background color to Green.
907 Ps = 4 3 -> Set background color to Yellow.
908 Ps = 4 4 -> Set background color to Blue.
909 Ps = 4 5 -> Set background color to Magenta.
910 Ps = 4 6 -> Set background color to Cyan.
911 Ps = 4 7 -> Set background color to White.
912 Ps = 4 9 -> Set background color to default, ECMA-48 3rd.
914 Some of the above note the edition of ECMA-48 which first
915 describes a feature. In its successive editions from 1979 to
916 1991 (2nd 1979, 3rd 1984, 4th 1986, and 5th 1991), ECMA-48
917 listed codes through 6 5 (skipping several toward the end of
918 the range). Most of the ECMA-48 codes not implemented in
919 xterm were never implemented in a hardware terminal. Several
920 (such as 3 9 and 4 9 ) are either noted in ECMA-48 as imple-
921 mentation defined, or described in vague terms.
923 The successive editions of ECMA-48 give little attention to
924 changes from one edition to the next, except to comment on
925 features which have become obsolete. ECMA-48 1st (1976) is
926 unavailable; there is no reliable source of information which
927 states whether "ANSI" color was defined in that edition, or
928 later (1979). The VT100 (1978) implemented the most commonly
929 used non-color video attributes which are given in the 2nd
930 edition.
932 While 8-color support is described in ECMA-48 2nd edition, the
933 VT500 series (introduced in 1993) were the first DEC terminals
934 implementing "ANSI" color. The DEC terminal's use of color is
935 known to differ from xterm; useful documentation on this
936 series became available too late to influence xterm.
938 If 16-color support is compiled, the following aixterm con-
939 trols apply. Assume that xterm's resources are set so that
940 the ISO color codes are the first 8 of a set of 16. Then the
941 aixterm colors are the bright versions of the ISO colors:
943 Ps = 9 0 -> Set foreground color to Black.
944 Ps = 9 1 -> Set foreground color to Red.
945 Ps = 9 2 -> Set foreground color to Green.
946 Ps = 9 3 -> Set foreground color to Yellow.
947 Ps = 9 4 -> Set foreground color to Blue.
948 Ps = 9 5 -> Set foreground color to Magenta.
949 Ps = 9 6 -> Set foreground color to Cyan.
950 Ps = 9 7 -> Set foreground color to White.
951 Ps = 1 0 0 -> Set background color to Black.
952 Ps = 1 0 1 -> Set background color to Red.
953 Ps = 1 0 2 -> Set background color to Green.
954 Ps = 1 0 3 -> Set background color to Yellow.
955 Ps = 1 0 4 -> Set background color to Blue.
956 Ps = 1 0 5 -> Set background color to Magenta.
957 Ps = 1 0 6 -> Set background color to Cyan.
958 Ps = 1 0 7 -> Set background color to White.
960 If xterm is compiled with the 16-color support disabled, it
961 supports the following, from rxvt:
962 Ps = 1 0 0 -> Set foreground and background color to
963 default.
965 XTerm maintains a color palette whose entries are identified
966 by an index beginning with zero. If 88- or 256-color support
967 is compiled, the following apply:
968 o All parameters are decimal integers.
969 o RGB values range from zero (0) to 255.
970 o ISO-8613-6 has been interpreted in more than one way;
971 xterm allows the semicolons separating the subparameters
972 in this control to be replaced by colons (but after the
973 first colon, colons must be used).
975 These ISO-8613-6 controls (marked in ECMA-48 5th edition as
976 "reserved for future standardization") are supported by xterm:
977 Pm = 3 8 ; 2 ; Pi ; Pr ; Pg ; Pb -> Set foreground color to
978 the closest match in xterm's palette for the given RGB
979 Pr/Pg/Pb. The color space identifier Pi is ignored.
980 Pm = 3 8 ; 5 ; Ps -> Set foreground color to Ps.
981 Pm = 4 8 ; 2 ; Pi ; Pr ; Pg ; Pb -> Set background color to
982 the closest match in xterm's palette for the given RGB
983 Pr/Pg/Pb. The color space identifier Pi is ignored.
984 Pm = 4 8 ; 5 ; Ps -> Set background color to Ps.
986 This variation on ISO-8613-6 is supported for compatibility
987 with KDE konsole:
988 Pm = 3 8 ; 2 ; Pr ; Pg ; Pb -> Set foreground color to the
989 closest match in xterm's palette for the given RGB Pr/Pg/Pb.
990 Pm = 4 8 ; 2 ; Pr ; Pg ; Pb -> Set background color to the
991 closest match in xterm's palette for the given RGB Pr/Pg/Pb.
993 If xterm is compiled with direct-color support, and the
994 resource directColor is true, then rather than choosing the
995 closest match, xterm asks the X server to directly render a
996 given color.
998 CSI > Ps ; Ps m
999 Set or reset resource-values used by xterm to decide whether
1000 to construct escape sequences holding information about the
1001 modifiers pressed with a given key.
1003 The first parameter identifies the resource to set/reset. The
1004 second parameter is the value to assign to the resource.
1006 If the second parameter is omitted, the resource is reset to
1007 its initial value.
1009 Ps = 0 -> modifyKeyboard.
1010 Ps = 1 -> modifyCursorKeys.
1011 Ps = 2 -> modifyFunctionKeys.
1012 Ps = 4 -> modifyOtherKeys.
1014 If no parameters are given, all resources are reset to their
1015 initial values.
1017 CSI Ps n Device Status Report (DSR).
1018 Ps = 5 -> Status Report.
1019 Result ("OK") is CSI 0 n
1020 Ps = 6 -> Report Cursor Position (CPR) [row;column].
1021 Result is CSI r ; c R
1023 Note: it is possible for this sequence to be sent by a func-
1024 tion key. For example, with the default keyboard configura-
1025 tion the shifted F1 key may send (with shift-, control-, alt-
1026 modifiers)
1028 CSI 1 ; 2 R , or
1029 CSI 1 ; 5 R , or
1030 CSI 1 ; 6 R , etc.
1032 The second parameter encodes the modifiers; values range from
1033 2 to 16. See the section PC-Style Function Keys for the
1034 codes. The modifyFunctionKeys and modifyKeyboard resources
1035 can change the form of the string sent from the modified F1
1036 key.
1038 CSI > Ps n
1039 Disable modifiers which may be enabled via the CSI > Ps; Ps m
1040 sequence. This corresponds to a resource value of "-1", which
1041 cannot be set with the other sequence.
1043 The parameter identifies the resource to be disabled:
1045 Ps = 0 -> modifyKeyboard.
1046 Ps = 1 -> modifyCursorKeys.
1047 Ps = 2 -> modifyFunctionKeys.
1048 Ps = 4 -> modifyOtherKeys.
1050 If the parameter is omitted, modifyFunctionKeys is disabled.
1051 When modifyFunctionKeys is disabled, xterm uses the modifier
1052 keys to make an extended sequence of functions rather than
1053 adding a parameter to each function key to denote the modi-
1054 fiers.
1056 CSI ? Ps n
1057 Device Status Report (DSR, DEC-specific).
1058 Ps = 6 -> Report Cursor Position (DECXCPR) [row;column] as
1059 CSI ? r ; c R (assumes the default page, i.e., "1").
1060 Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready).
1061 or CSI ? 1 1 n (not ready).
1062 Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked) or
1063 CSI ? 2 1 n (locked).
1064 Ps = 2 6 -> Report Keyboard status as
1065 CSI ? 2 7 ; 1 ; 0 ; 0 n (North American).
1067 The last two parameters apply to VT300 & up (keyboard ready)
1068 and VT400 & up (LK01) respectively.
1070 Ps = 5 3 -> Report Locator status as CSI ? 5 3 n Locator
1071 available, if compiled-in, or CSI ? 5 0 n No Locator, if not.
1072 Ps = 5 5 -> Report Locator status as CSI ? 5 3 n Locator
1073 available, if compiled-in, or CSI ? 5 0 n No Locator, if not.
1074 Ps = 5 6 -> Report Locator type as CSI ? 5 7 ; 1 n Mouse,
1075 if compiled-in, or CSI ? 5 7 ; 0 n Cannot identify, if not.
1076 Ps = 6 2 -> Report macro space (DECMSR) as CSI Pn * { .
1077 Ps = 6 3 -> Report memory checksum (DECCKSR) as DCS Pt ! x
1078 x x x ST .
1079 Pt is the request id (from an optional parameter to the
1080 request).
1081 The x's are hexadecimal digits 0-9 and A-F.
1082 Ps = 7 5 -> Report data integrity as CSI ? 7 0 n (ready,
1083 no errors).
1084 Ps = 8 5 -> Report multi-session configuration as CSI ? 8 3
1085 n (not configured for multiple-session operation).
1087 CSI > Ps p
1088 Set resource value pointerMode. This is used by xterm to
1089 decide whether to hide the pointer cursor as the user types.
1091 Valid values for the parameter:
1092 Ps = 0 -> never hide the pointer.
1093 Ps = 1 -> hide if the mouse tracking mode is not enabled.
1094 Ps = 2 -> always hide the pointer, except when leaving the
1095 window.
1096 Ps = 3 -> always hide the pointer, even if leaving/entering
1097 the window.
1099 If no parameter is given, xterm uses the default, which is 1 .
1101 CSI ! p Soft terminal reset (DECSTR), VT220 and up.
1103 CSI Ps ; Ps " p
1104 Set conformance level (DECSCL), VT220 and up.
1106 The first parameter selects the conformance level. Valid val-
1107 ues are:
1108 Ps = 6 1 -> level 1, e.g., VT100.
1109 Ps = 6 2 -> level 2, e.g., VT200.
1110 Ps = 6 3 -> level 3, e.g., VT300.
1111 Ps = 6 4 -> level 4, e.g., VT400.
1112 Ps = 6 5 -> level 5, e.g., VT500.
1114 The second parameter selects the C1 control transmission mode.
1115 This is an optional parameter, ignored in conformance level 1.
1116 Valid values are:
1117 Ps = 0 -> 8-bit controls.
1118 Ps = 1 -> 7-bit controls (DEC factory default).
1119 Ps = 2 -> 8-bit controls.
1121 The 7-bit and 8-bit control modes can also be set by S7C1T and
1122 S8C1T, but DECSCL is preferred.
1124 CSI Ps $ p
1125 Request ANSI mode (DECRQM). For VT300 and up, reply DECRPM is
1126 CSI Ps; Pm$ y
1127 where Ps is the mode number as in SM/RM, and Pm is the mode
1128 value:
1129 0 - not recognized
1130 1 - set
1131 2 - reset
1132 3 - permanently set
1133 4 - permanently reset
1135 CSI ? Ps $ p
1136 Request DEC private mode (DECRQM). For VT300 and up, reply
1137 DECRPM is
1138 CSI ? Ps; Pm$ y
1139 where Ps is the mode number as in DECSET/DECSET, Pm is the
1140 mode value as in the ANSI DECRQM.
1141 Two private modes are read-only (i.e., 1 3 and 1 4 ), pro-
1142 vided only for reporting their values using this control
1143 sequence. They correspond to the resources cursorBlink and
1144 cursorBlinkXOR.
1145 CSI # p
1146 CSI Ps ; Ps # p
1147 Push video attributes onto stack (XTPUSHSGR), xterm. This is
1148 an alias for CSI # { , used to work around language limita-
1149 tions of C#.
1151 CSI Ps q Load LEDs (DECLL), VT100.
1152 Ps = 0 -> Clear all LEDS (default).
1153 Ps = 1 -> Light Num Lock.
1154 Ps = 2 -> Light Caps Lock.
1155 Ps = 3 -> Light Scroll Lock.
1156 Ps = 2 1 -> Extinguish Num Lock.
1157 Ps = 2 2 -> Extinguish Caps Lock.
1158 Ps = 2 3 -> Extinguish Scroll Lock.
1160 CSI Ps SP q
1161 Set cursor style (DECSCUSR), VT520.
1162 Ps = 0 -> blinking block.
1163 Ps = 1 -> blinking block (default).
1164 Ps = 2 -> steady block.
1165 Ps = 3 -> blinking underline.
1166 Ps = 4 -> steady underline.
1167 Ps = 5 -> blinking bar (xterm).
1168 Ps = 6 -> steady bar (xterm).
1170 CSI Ps " q
1171 Select character protection attribute (DECSCA). Valid values
1172 for the parameter:
1173 Ps = 0 -> DECSED and DECSEL can erase (default).
1174 Ps = 1 -> DECSED and DECSEL cannot erase.
1175 Ps = 2 -> DECSED and DECSEL can erase.
1177 CSI # q Pop video attributes from stack (XTPOPSGR), xterm. This is an
1178 alias for CSI # } , used to work around language limitations
1179 of C#.
1181 CSI Ps ; Ps r
1182 Set Scrolling Region [top;bottom] (default = full size of win-
1183 dow) (DECSTBM), VT100.
1185 CSI ? Pm r
1186 Restore DEC Private Mode Values. The value of Ps previously
1187 saved is restored. Ps values are the same as for DECSET.
1189 CSI Pt ; Pl ; Pb ; Pr ; Ps $ r
1190 Change Attributes in Rectangular Area (DECCARA), VT400 and up.
1191 Pt ; Pl ; Pb ; Pr denotes the rectangle.
1192 Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7.
1194 CSI s Save cursor, available only when DECLRMM is disabled (SCOSC,
1195 also ANSI.SYS).
1197 CSI Pl ; Pr s
1198 Set left and right margins (DECSLRM), VT420 and up. This is
1199 available only when DECLRMM is enabled.
1201 CSI ? Pm s
1202 Save DEC Private Mode Values. Ps values are the same as for
1203 DECSET.
1205 CSI Ps ; Ps ; Ps t
1206 Window manipulation (from dtterm, as well as extensions by
1207 xterm). These controls may be disabled using the allowWin-
1208 dowOps resource.
1210 xterm uses Extended Window Manager Hints (EWMH) to maximize
1211 the window. Some window managers have incomplete support for
1212 EWMH. For instance, fvwm, flwm and quartz-wm advertise sup-
1213 port for maximizing windows horizontally or vertically, but in
1214 fact equate those to the maximize operation.
1216 Valid values for the first (and any additional parameters)
1217 are:
1218 Ps = 1 -> De-iconify window.
1219 Ps = 2 -> Iconify window.
1220 Ps = 3 ; x ; y -> Move window to [x, y].
1221 Ps = 4 ; height ; width -> Resize the xterm window to
1222 given height and width in pixels. Omitted parameters reuse
1223 the current height or width. Zero parameters use the dis-
1224 play's height or width.
1225 Ps = 5 -> Raise the xterm window to the front of the stack-
1226 ing order.
1227 Ps = 6 -> Lower the xterm window to the bottom of the
1228 stacking order.
1229 Ps = 7 -> Refresh the xterm window.
1230 Ps = 8 ; height ; width -> Resize the text area to given
1231 height and width in characters. Omitted parameters reuse the
1232 current height or width. Zero parameters use the display's
1233 height or width.
1234 Ps = 9 ; 0 -> Restore maximized window.
1235 Ps = 9 ; 1 -> Maximize window (i.e., resize to screen
1236 size).
1237 Ps = 9 ; 2 -> Maximize window vertically.
1238 Ps = 9 ; 3 -> Maximize window horizontally.
1239 Ps = 1 0 ; 0 -> Undo full-screen mode.
1240 Ps = 1 0 ; 1 -> Change to full-screen.
1241 Ps = 1 0 ; 2 -> Toggle full-screen.
1242 Ps = 1 1 -> Report xterm window state.
1243 If the xterm window is non-iconified, it returns CSI 1 t .
1244 If the xterm window is iconified, it returns CSI 2 t .
1245 Ps = 1 3 -> Report xterm window position.
1246 Note: X Toolkit positions can be negative, but the reported
1247 values are unsigned, in the range 0-65535. Negative values
1248 correspond to 32768-65535.
1249 Result is CSI 3 ; x ; y t
1250 Ps = 1 3 ; 2 -> Report xterm text-area position.
1251 Result is CSI 3 ; x ; y t
1252 Ps = 1 4 -> Report xterm text area size in pixels.
1253 Result is CSI 4 ; height ; width t
1254 Ps = 1 4 ; 2 -> Report xterm window size in pixels.
1255 Normally xterm's window is larger than its text area, since it
1256 includes the frame (or decoration) applied by the window man-
1257 ager, as well as the area used by a scroll-bar.
1258 Result is CSI 4 ; height ; width t
1259 Ps = 1 5 -> Report size of the screen in pixels.
1260 Result is CSI 5 ; height ; width t
1261 Ps = 1 6 -> Report xterm character size in pixels.
1262 Result is CSI 6 ; height ; width t
1263 Ps = 1 8 -> Report the size of the text area in characters.
1264 Result is CSI 8 ; height ; width t
1265 Ps = 1 9 -> Report the size of the screen in characters.
1266 Result is CSI 9 ; height ; width t
1267 Ps = 2 0 -> Report xterm window's icon label.
1268 Result is OSC L label ST
1269 Ps = 2 1 -> Report xterm window's title.
1270 Result is OSC l label ST
1272 Ps = 2 2 ; 0 -> Save xterm icon and window title on stack.
1273 Ps = 2 2 ; 1 -> Save xterm icon title on stack.
1274 Ps = 2 2 ; 2 -> Save xterm window title on stack.
1275 Ps = 2 3 ; 0 -> Restore xterm icon and window title from
1276 stack.
1277 Ps = 2 3 ; 1 -> Restore xterm icon title from stack.
1278 Ps = 2 3 ; 2 -> Restore xterm window title from stack.
1280 Ps >= 2 4 -> Resize to Ps lines (DECSLPP), VT340 and VT420.
1281 xterm adapts this by resizing its window.
1283 CSI > Ps ; Ps t
1284 This xterm control sets one or more features of the title
1285 modes. Each parameter enables a single feature.
1286 Ps = 0 -> Set window/icon labels using hexadecimal.
1287 Ps = 1 -> Query window/icon labels using hexadecimal.
1288 Ps = 2 -> Set window/icon labels using UTF-8.
1289 Ps = 3 -> Query window/icon labels using UTF-8. (See dis-
1290 cussion of Title Modes)
1292 CSI Ps SP t
1293 Set warning-bell volume (DECSWBV), VT520.
1294 Ps = 0 or 1 -> off.
1295 Ps = 2 , 3 or 4 -> low.
1296 Ps = 5 , 6 , 7 , or 8 -> high.
1298 CSI Pt ; Pl ; Pb ; Pr ; Ps $ t
1299 Reverse Attributes in Rectangular Area (DECRARA), VT400 and
1300 up.
1301 Pt ; Pl ; Pb ; Pr denotes the rectangle.
1302 Ps denotes the attributes to reverse, i.e., 1, 4, 5, 7.
1304 CSI u Restore cursor (SCORC, also ANSI.SYS).
1306 CSI Ps SP u
1307 Set margin-bell volume (DECSMBV), VT520.
1308 Ps = 1 -> off.
1309 Ps = 2 , 3 or 4 -> low.
1310 Ps = 0 , 5 , 6 , 7 , or 8 -> high.
1312 CSI Pt ; Pl ; Pb ; Pr ; Pp ; Pt ; Pl ; Pp $ v
1313 Copy Rectangular Area (DECCRA), VT400 and up.
1314 Pt ; Pl ; Pb ; Pr denotes the rectangle.
1315 Pp denotes the source page.
1316 Pt ; Pl denotes the target location.
1317 Pp denotes the target page.
1319 CSI Ps $ w
1320 Request presentation state report (DECRQPSR), VT320 and up.
1321 Ps = 0 -> error.
1322 Ps = 1 -> cursor information report (DECCIR).
1323 Response is
1324 DCS 1 $ u Pt ST
1325 Refer to the VT420 programming manual, which requires six
1326 pages to document the data string Pt,
1327 Ps = 2 -> tab stop report (DECTABSR).
1328 Response is
1329 DCS 2 $ u Pt ST
1330 The data string Pt is a list of the tab-stops, separated by
1331 "/" characters.
1333 CSI Pt ; Pl ; Pb ; Pr ' w
1334 Enable Filter Rectangle (DECEFR), VT420 and up.
1335 Parameters are [top;left;bottom;right].
1336 Defines the coordinates of a filter rectangle and activates
1337 it. Anytime the locator is detected outside of the filter
1338 rectangle, an outside rectangle event is generated and the
1339 rectangle is disabled. Filter rectangles are always treated
1340 as "one-shot" events. Any parameters that are omitted default
1341 to the current locator position. If all parameters are omit-
1342 ted, any locator motion will be reported. DECELR always can-
1343 cels any prevous rectangle definition.
1345 CSI Ps x Request Terminal Parameters (DECREQTPARM).
1346 if Ps is a "0" (default) or "1", and xterm is emulating VT100,
1347 the control sequence elicits a response of the same form whose
1348 parameters describe the terminal:
1349 Ps -> the given Ps incremented by 2.
1350 Pn = 1 <- no parity.
1351 Pn = 1 <- eight bits.
1352 Pn = 1 <- 2 8 transmit 38.4k baud.
1353 Pn = 1 <- 2 8 receive 38.4k baud.
1354 Pn = 1 <- clock multiplier.
1355 Pn = 0 <- STP flags.
1357 CSI Ps * x
1358 Select Attribute Change Extent (DECSACE), VT420 and up.
1359 Ps = 0 -> from start to end position, wrapped.
1360 Ps = 1 -> from start to end position, wrapped.
1361 Ps = 2 -> rectangle (exact).
1363 CSI Pc ; Pt ; Pl ; Pb ; Pr $ x
1364 Fill Rectangular Area (DECFRA), VT420 and up.
1365 Pc is the character to use.
1366 Pt ; Pl ; Pb ; Pr denotes the rectangle.
1368 CSI Ps # y
1369 Select checksum extension (XTCHECKSUM), xterm. The bits of Ps
1370 modify the calculation of the checksum returned by DECRQCRA:
1371 0 -> do not negate the result.
1372 1 -> do not report the VT100 video attributes.
1373 2 -> do not omit checksum for blanks.
1374 3 -> omit checksum for cells not explicitly initialized.
1375 4 -> do not mask cell value to 8 bits or ignore combining
1376 characters.
1377 5 -> do not mask cell value to 7 bits.
1379 CSI Pi ; Pg ; Pt ; Pl ; Pb ; Pr * y
1380 Request Checksum of Rectangular Area (DECRQCRA), VT420 and up.
1381 Response is
1382 DCS Pi ! x x x x ST
1383 Pi is the request id.
1384 Pg is the page number.
1385 Pt ; Pl ; Pb ; Pr denotes the rectangle.
1386 The x's are hexadecimal digits 0-9 and A-F.
1388 CSI Ps ; Pu ' z
1389 Enable Locator Reporting (DECELR).
1390 Valid values for the first parameter:
1391 Ps = 0 -> Locator disabled (default).
1392 Ps = 1 -> Locator enabled.
1393 Ps = 2 -> Locator enabled for one report, then disabled.
1394 The second parameter specifies the coordinate unit for locator
1395 reports.
1396 Valid values for the second parameter:
1397 Pu = 0 <- or omitted -> default to character cells.
1398 Pu = 1 <- device physical pixels.
1399 Pu = 2 <- character cells.
1401 CSI Pt ; Pl ; Pb ; Pr $ z
1402 Erase Rectangular Area (DECERA), VT400 and up.
1403 Pt ; Pl ; Pb ; Pr denotes the rectangle.
1405 CSI Pm ' {
1406 Select Locator Events (DECSLE).
1407 Valid values for the first (and any additional parameters)
1408 are:
1409 Ps = 0 -> only respond to explicit host requests (DECRQLP).
1410 This is default. It also cancels any filter rectangle.
1411 Ps = 1 -> report button down transitions.
1412 Ps = 2 -> do not report button down transitions.
1413 Ps = 3 -> report button up transitions.
1414 Ps = 4 -> do not report button up transitions.
1416 CSI # {
1417 CSI Ps ; Ps # {
1418 Push video attributes onto stack (XTPUSHSGR), xterm. The
1419 optional parameters correspond to the SGR encoding for video
1420 attributes, except for colors (which do not have a unique SGR
1421 code):
1422 Ps = 1 -> Bold.
1423 Ps = 2 -> Faint.
1424 Ps = 3 -> Italicized.
1425 Ps = 4 -> Underlined.
1426 Ps = 5 -> Blink.
1427 Ps = 7 -> Inverse.
1428 Ps = 8 -> Invisible.
1429 Ps = 9 -> Crossed-out characters.
1430 Ps = 1 0 -> Foreground color.
1431 Ps = 1 1 -> Background color.
1432 Ps = 2 1 -> Doubly-underlined.
1434 If no parameters are given, all of the video attributes are
1435 saved. The stack is limited to 10 levels.
1437 CSI Pt ; Pl ; Pb ; Pr $ {
1438 Selective Erase Rectangular Area (DECSERA), VT400 and up.
1439 Pt ; Pl ; Pb ; Pr denotes the rectangle.
1441 CSI Pt ; Pl ; Pb ; Pr # |
1442 Report selected graphic rendition (XTREPORTSGR), xterm. The
1443 response is an SGR sequence which contains the attributes
1444 which are common to all cells in a rectangle.
1445 Pt ; Pl ; Pb ; Pr denotes the rectangle.
1447 CSI Ps $ |
1448 Select columns per page (DECSCPP), VT340.
1449 Ps = 0 -> 80 columns, default if Ps omitted.
1450 Ps = 8 0 -> 80 columns.
1451 Ps = 1 3 2 -> 132 columns.
1453 CSI Ps ' |
1454 Request Locator Position (DECRQLP).
1455 Valid values for the parameter are:
1456 Ps = 0 , 1 or omitted -> transmit a single DECLRP locator
1457 report.
1459 If Locator Reporting has been enabled by a DECELR, xterm will
1460 respond with a DECLRP Locator Report. This report is also
1461 generated on button up and down events if they have been
1462 enabled with a DECSLE, or when the locator is detected outside
1463 of a filter rectangle, if filter rectangles have been enabled
1464 with a DECEFR.
1466 -> CSI Pe ; Pb ; Pr ; Pc ; Pp & w
1468 Parameters are [event;button;row;column;page].
1469 Valid values for the event:
1470 Pe = 0 -> locator unavailable - no other parameters sent.
1471 Pe = 1 -> request - xterm received a DECRQLP.
1472 Pe = 2 -> left button down.
1473 Pe = 3 -> left button up.
1474 Pe = 4 -> middle button down.
1475 Pe = 5 -> middle button up.
1476 Pe = 6 -> right button down.
1477 Pe = 7 -> right button up.
1478 Pe = 8 -> M4 button down.
1479 Pe = 9 -> M4 button up.
1480 Pe = 1 0 -> locator outside filter rectangle.
1481 The "button" parameter is a bitmask indicating which buttons
1482 are pressed:
1483 Pb = 0 <- no buttons down.
1484 Pb & 1 <- right button down.
1485 Pb & 2 <- middle button down.
1486 Pb & 4 <- left button down.
1487 Pb & 8 <- M4 button down.
1488 The "row" and "column" parameters are the coordinates of the
1489 locator position in the xterm window, encoded as ASCII deci-
1490 mal.
1491 The "page" parameter is not used by xterm.
1493 CSI Ps * |
1494 Select number of lines per screen (DECSNLS), VT420 and up.
1496 CSI # } Pop video attributes from stack (XTPOPSGR), xterm. Popping
1497 restores the video-attributes which were saved using XTPUSHSGR
1498 to their previous state.
1500 CSI Pm ' }
1501 Insert Ps Column(s) (default = 1) (DECIC), VT420 and up.
1503 CSI Pm ' ~
1504 Delete Ps Column(s) (default = 1) (DECDC), VT420 and up.
1506 Operating System Commands
1508 OSC Ps ; Pt BEL
1510 OSC Ps ; Pt ST
1511 Set Text Parameters. For colors and font, if Pt is a "?", the
1512 control sequence elicits a response which consists of the con-
1513 trol sequence which would set the corresponding value. The
1514 dtterm control sequences allow you to determine the icon name
1515 and window title.
1516 Ps = 0 -> Change Icon Name and Window Title to Pt.
1517 Ps = 1 -> Change Icon Name to Pt.
1518 Ps = 2 -> Change Window Title to Pt.
1519 Ps = 3 -> Set X property on top-level window. Pt should be
1520 in the form "prop=value", or just "prop" to delete the prop-
1521 erty.
1522 Ps = 4 ; c ; spec -> Change Color Number c to the color
1523 specified by spec. This can be a name or RGB specification as
1524 per XParseColor. Any number of c/spec pairs may be given.
1525 The color numbers correspond to the ANSI colors 0-7, their
1526 bright versions 8-15, and if supported, the remainder of the
1527 88-color or 256-color table.
1529 If a "?" is given rather than a name or RGB specification,
1530 xterm replies with a control sequence of the same form which
1531 can be used to set the corresponding color. Because more than
1532 one pair of color number and specification can be given in one
1533 control sequence, xterm can make more than one reply.
1535 Ps = 5 ; c ; spec -> Change Special Color Number c to the
1536 color specified by spec. This can be a name or RGB specifica-
1537 tion as per XParseColor. Any number of c/spec pairs may be
1538 given. The special colors can also be set by adding the maxi-
1539 mum number of colors to these codes in an OSC 4 control:
1541 Pc = 0 <- resource colorBD (BOLD).
1542 Pc = 1 <- resource colorUL (UNDERLINE).
1543 Pc = 2 <- resource colorBL (BLINK).
1544 Pc = 3 <- resource colorRV (REVERSE).
1545 Pc = 4 <- resource colorIT (ITALIC).
1547 Ps = 6 ; c ; f -> Enable/disable Special Color Number c.
1548 OSC 6 is the same as OSC 1 0 6 .
1550 The 10 colors (below) which may be set or queried using 1 0
1551 through 1 9 are denoted dynamic colors, since the correspond-
1552 ing control sequences were the first means for setting xterm's
1553 colors dynamically, i.e., after it was started. They are not
1554 the same as the ANSI colors (however, the dynamic text fore-
1555 ground and background colors are used when ANSI colors are
1556 reset using SGR 3 9 and 4 9 , respectively). These controls
1557 may be disabled using the allowColorOps resource. At least
1558 one parameter is expected for Pt. Each successive parameter
1559 changes the next color in the list. The value of Ps tells the
1560 starting point in the list. The colors are specified by name
1561 or RGB specification as per XParseColor.
1563 If a "?" is given rather than a name or RGB specification,
1564 xterm replies with a control sequence of the same form which
1565 can be used to set the corresponding dynamic color. Because
1566 more than one pair of color number and specification can be
1567 given in one control sequence, xterm can make more than one
1568 reply.
1570 Ps = 1 0 -> Change VT100 text foreground color to Pt.
1571 Ps = 1 1 -> Change VT100 text background color to Pt.
1572 Ps = 1 2 -> Change text cursor color to Pt.
1573 Ps = 1 3 -> Change mouse foreground color to Pt.
1574 Ps = 1 4 -> Change mouse background color to Pt.
1575 Ps = 1 5 -> Change Tektronix foreground color to Pt.
1576 Ps = 1 6 -> Change Tektronix background color to Pt.
1577 Ps = 1 7 -> Change highlight background color to Pt.
1578 Ps = 1 8 -> Change Tektronix cursor color to Pt.
1579 Ps = 1 9 -> Change highlight foreground color to Pt.
1581 Ps = 4 6 -> Change Log File to Pt. This is normally dis-
1582 abled by a compile-time option.
1584 Ps = 5 0 -> Set Font to Pt. These controls may be disabled
1585 using the allowFontOps resource. If Pt begins with a "#",
1586 index in the font menu, relative (if the next character is a
1587 plus or minus sign) or absolute. A number is expected but not
1588 required after the sign (the default is the current entry for
1589 relative, zero for absolute indexing).
1591 The same rule (plus or minus sign, optional number) is used
1592 when querying the font. The remainder of Pt is ignored.
1594 A font can be specified after a "#" index expression, by
1595 adding a space and then the font specifier.
1597 If the TrueType Fonts menu entry is set (the renderFont
1598 resource), then this control sets/queries the faceName
1599 resource.
1601 Ps = 5 1 -> reserved for Emacs shell.
1603 Ps = 5 2 -> Manipulate Selection Data. These controls may
1604 be disabled using the allowWindowOps resource. The parameter
1605 Pt is parsed as
1606 Pc ; Pd
1607 The first, Pc, may contain zero or more characters from the
1608 set c , p , q , s , 0 , 1 , 2 , 3 , 4 , 5 , 6 , and 7 . It is
1609 used to construct a list of selection parameters for clip-
1610 board, primary, secondary, select, or cut buffers 0 through 7
1611 respectively, in the order given. If the parameter is empty,
1612 xterm uses s 0 , to specify the configurable primary/clipboard
1613 selection and cut buffer 0.
1615 The second parameter, Pd, gives the selection data. Normally
1616 this is a string encoded in base64 (RFC-4648). The data
1617 becomes the new selection, which is then available for pasting
1618 by other applications.
1620 If the second parameter is a ? , xterm replies to the host
1621 with the selection data encoded using the same protocol. It
1622 uses the first selection found by asking successively for each
1623 item from the list of selection parameters.
1625 If the second parameter is neither a base64 string nor ? ,
1626 then the selection is cleared.
1628 Ps = 1 0 4 ; c -> Reset Color Number c. It is reset to the
1629 color specified by the corresponding X resource. Any number
1630 of c parameters may be given. These parameters correspond to
1631 the ANSI colors 0-7, their bright versions 8-15, and if sup-
1632 ported, the remainder of the 88-color or 256-color table. If
1633 no parameters are given, the entire table will be reset.
1635 Ps = 1 0 5 ; c -> Reset Special Color Number c. It is reset
1636 to the color specified by the corresponding X resource. Any
1637 number of c parameters may be given. These parameters corre-
1638 spond to the special colors which can be set using an OSC 5
1639 control (or by adding the maximum number of colors using an
1640 OSC 4 control).
1642 Ps = 1 0 6 ; c ; f -> Enable/disable Special Color Number c.
1643 The second parameter tells xterm to enable the corresponding
1644 color mode if nonzero, disable it if zero.
1646 Pc = 0 <- resource colorBDMode (BOLD).
1647 Pc = 1 <- resource colorULMode (UNDERLINE).
1648 Pc = 2 <- resource colorBLMode (BLINK).
1649 Pc = 3 <- resource colorRVMode (REVERSE).
1650 Pc = 4 <- resource colorITMode (ITALIC).
1651 Pc = 5 <- resource colorAttrMode (Override ANSI).
1653 The dynamic colors can also be reset to their default
1654 (resource) values:
1655 Ps = 1 1 0 -> Reset VT100 text foreground color.
1656 Ps = 1 1 1 -> Reset VT100 text background color.
1657 Ps = 1 1 2 -> Reset text cursor color.
1658 Ps = 1 1 3 -> Reset mouse foreground color.
1659 Ps = 1 1 4 -> Reset mouse background color.
1660 Ps = 1 1 5 -> Reset Tektronix foreground color.
1661 Ps = 1 1 6 -> Reset Tektronix background color.
1662 Ps = 1 1 7 -> Reset highlight color.
1663 Ps = 1 1 8 -> Reset Tektronix cursor color.
1664 Ps = 1 1 9 -> Reset highlight foreground color.
1666 Ps = I ; c -> Set icon to file. Sun shelltool, CDE dtterm.
1667 The file is expected to be XPM format, and uses the same
1668 search logic as the iconHint resource.
1670 Ps = l ; c -> Set window title. Sun shelltool, CDE dtterm.
1672 Ps = L ; c -> Set icon label. Sun shelltool, CDE dtterm.
1674 Privacy Message
1676 PM Pt ST xterm implements no PM functions; Pt is ignored. Pt need not
1677 be printable characters.
1679 Alt and Meta Keys
1681 Many keyboards have keys labeled "Alt". Few have keys labeled "Meta".
1682 However, xterm's default translations use the Meta modifier. Common
1683 keyboard configurations assign the Meta modifier to an "Alt" key. By
1684 using xmodmap one may have the modifier assigned to a different key, and
1685 have "real" alt and meta keys. Here is an example:
1687 ! put meta on mod3 to distinguish it from alt
1688 keycode 64 = Alt_L
1689 clear mod1
1690 add mod1 = Alt_L
1691 keycode 115 = Meta_L
1692 clear mod3
1693 add mod3 = Meta_L
1695 The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set)
1696 can be used to control the way the Meta modifier applies to ordinary
1697 keys unless the modifyOtherKeys resource is set:
1699 o prefix a key with the ESC character.
1701 o shift the key from codes 0-127 to 128-255 by adding 128.
1703 The table shows the result for a given character "x" with modifiers
1704 according to the default translations with the resources set on or off.
1705 This assumes altIsNotMeta is set:
1707 -----------------------------------------------------------
1708 key altSendsEscape metaSendsEscape result
1709 -----------+----------------+-----------------+------------
1710 x | off | off | x
1711 Meta-x | off | off | shift
1712 Alt-x | off | off | shift
1713 Alt+Meta-x | off | off | shift
1714 x | ON | off | x
1715 Meta-x | ON | off | shift
1716 Alt-x | ON | off | ESC x
1717 Alt+Meta-x | ON | off | ESC shift
1718 x | off | ON | x
1719 Meta-x | off | ON | ESC x
1720 Alt-x | off | ON | shift
1721 Alt+Meta-x | off | ON | ESC shift
1722 x | ON | ON | x
1723 Meta-x | ON | ON | ESC x
1724 Alt-x | ON | ON | ESC x
1725 Alt+Meta-x | ON | ON | ESC x
1726 -----------+----------------+-----------------+------------
1728 PC-Style Function Keys
1730 If xterm does minimal translation of the function keys, it usually does
1731 this with a PC-style keyboard, so PC-style function keys result. Sun
1732 keyboards are similar to PC keyboards. Both have cursor and scrolling
1733 operations printed on the keypad, which duplicate the smaller cursor and
1734 scrolling keypads.
1736 X does not predefine NumLock (used for VT220 keyboards) or Alt (used as
1737 an extension for the Sun/PC keyboards) as modifiers. These keys are
1738 recognized as modifiers when enabled by the numLock resource, or by the
1739 "DECSET 1 0 3 5 " control sequence.
1741 The cursor keys transmit the following escape sequences depending on the
1742 mode specified via the DECCKM escape sequence.
1744 Key Normal Application
1745 -------------+----------+-------------
1746 Cursor Up | CSI A | SS3 A
1747 Cursor Down | CSI B | SS3 B
1748 Cursor Right | CSI C | SS3 C
1749 Cursor Left | CSI D | SS3 D
1750 -------------+----------+-------------
1752 The home- and end-keys (unlike PageUp and other keys also on the 6-key
1753 editing keypad) are considered "cursor keys" by xterm. Their mode is
1754 also controlled by the DECCKM escape sequence:
1756 Key Normal Application
1757 ---------+----------+-------------
1758 Home | CSI H | SS3 H
1759 End | CSI F | SS3 F
1760 ---------+----------+-------------
1762 The application keypad transmits the following escape sequences depend-
1763 ing on the mode specified via the DECKPNM and DECKPAM escape sequences.
1764 Use the NumLock key to override the application mode.
1766 Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are
1767 supported by the program.
1769 Key Numeric Application Terminfo Termcap
1770 ---------------+----------+-------------+----------+----------
1771 Space | SP | SS3 SP | - | -
1772 Tab | TAB | SS3 I | - | -
1773 Enter | CR | SS3 M | kent | @8
1774 PF1 | SS3 P | SS3 P | kf1 | k1
1775 PF2 | SS3 Q | SS3 Q | kf2 | k2
1776 PF3 | SS3 R | SS3 R | kf3 | k3
1777 PF4 | SS3 S | SS3 S | kf4 | k4
1778 * (multiply) | * | SS3 j | - | -
1779 + (add) | + | SS3 k | - | -
1780 , (comma) | , | SS3 l | - | -
1781 - (minus) | - | SS3 m | - | -
1782 . (Delete) | . | CSI 3 ~ | - | -
1783 / (divide) | / | SS3 o | - | -
1784 0 (Insert) | 0 | CSI 2 ~ | - | -
1785 1 (End) | 1 | SS3 F | kc1 | K4
1786 2 (DownArrow) | 2 | CSI B | - | -
1787 3 (PageDown) | 3 | CSI 6 ~ | kc3 | K5
1788 4 (LeftArrow) | 4 | CSI D | - | -
1789 5 (Begin) | 5 | CSI E | kb2 | K2
1790 6 (RightArrow) | 6 | CSI C | - | -
1791 7 (Home) | 7 | SS3 H | ka1 | K1
1792 8 (UpArrow) | 8 | CSI A | - | -
1793 9 (PageUp) | 9 | CSI 5 ~ | ka3 | K3
1794 = (equal) | = | SS3 X | - | -
1795 ---------------+----------+-------------+----------+----------
1797 They also provide 12 function keys, as well as a few other special-pur-
1798 pose keys:
1800 Key Escape Sequence
1801 ---------+-----------------
1802 F1 | SS3 P
1803 F2 | SS3 Q
1804 F3 | SS3 R
1805 F4 | SS3 S
1806 F5 | CSI 1 5 ~
1807 F6 | CSI 1 7 ~
1808 F7 | CSI 1 8 ~
1809 F8 | CSI 1 9 ~
1810 F9 | CSI 2 0 ~
1811 F10 | CSI 2 1 ~
1812 F11 | CSI 2 3 ~
1813 F12 | CSI 2 4 ~
1814 ---------+-----------------
1816 Note that F1 through F4 are prefixed with SS3 , while the other keys are
1817 prefixed with CSI . Older versions of xterm implement different escape
1818 sequences for F1 through F4, with a CSI prefix. These can be activated
1819 by setting the oldXtermFKeys resource. However, since they do not cor-
1820 respond to any hardware terminal, they have been deprecated. (The DEC
1821 VT220 reserves F1 through F5 for local functions such as Setup).
1823 Key Escape Sequence
1824 ---------+-----------------
1825 F1 | CSI 1 1 ~
1826 F2 | CSI 1 2 ~
1827 F3 | CSI 1 3 ~
1828 F4 | CSI 1 4 ~
1829 ---------+-----------------
1831 In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is
1832 false (and none of the other keyboard resources such as oldXtermFKeys
1833 resource is set), xterm encodes function key modifiers as parameters
1834 appended before the final character of the control sequence. As a spe-
1835 cial case, the SS3 sent before F1 through F4 is altered to CSI when
1836 sending a function key modifier as a parameter.
1838 Code Modifiers
1839 ---------+---------------------------
1840 2 | Shift
1841 3 | Alt
1842 4 | Shift + Alt
1843 5 | Control
1844 6 | Shift + Control
1845 7 | Alt + Control
1846 8 | Shift + Alt + Control
1847 9 | Meta
1848 10 | Meta + Shift
1849 11 | Meta + Alt
1850 12 | Meta + Alt + Shift
1851 13 | Meta + Ctrl
1852 14 | Meta + Ctrl + Shift
1853 15 | Meta + Ctrl + Alt
1854 16 | Meta + Ctrl + Alt + Shift
1855 ---------+---------------------------
1857 For example, shift-F5 would be sent as CSI 1 5 ; 2 ~
1859 If the alwaysUseMods resource is set, the Meta modifier also is recog-
1860 nized, making parameters 9 through 16.
1862 The codes used for the PC-style function keys were inspired by a feature
1863 of the VT510, referred to in its reference manual as DECFNK. In the
1864 DECFNK scheme, codes 2-8 identify modifiers for function-keys and cur-
1865 sor-, editing-keypad keys. Unlike xterm, the VT510 limits the modifiers
1866 which can be used with cursor- and editing-keypad keys. Although the
1867 name "DECFNK" implies that it is a mode, the VT510 manual mentions it
1868 only as a feature, which (like xterm) interacts with the DECUDK feature.
1869 Unlike xterm, VT510/VT520 provide an extension to DECUDK (DECPFK and
1870 DECPAK) which apparently was the reason for the feature in those termi-
1871 nals, i.e., for identifying a programmable key rather than making it
1872 simple for applications to obtain modifier information. It is not
1873 described in the related VT520 manual. Neither manual was readily
1874 available at the time the feature was added to xterm.
1876 On the other hand, the VT510 and VT520 reference manuals do document a
1877 related feature. That is its emulation of the SCO console, which is
1878 similar to the "xterm-sco" terminal description. The SCO console func-
1879 tion-keys are less useful to applications developers than the approach
1880 used by xterm because
1882 o the relationship between modifiers and the characters sent by func-
1883 tion-keys is not readily apparent, and
1885 o the scheme is not extensible, i.e., it is an ad hoc asssignment lim-
1886 ited to two modifiers (shift and control).
1888 VT220-Style Function Keys
1890 However, xterm is most useful as a DEC VT102 or VT220 emulator. Set the
1891 sunKeyboard resource to true to force a Sun/PC keyboard to act like a
1892 VT220 keyboard.
1894 The VT102/VT220 application keypad transmits unique escape sequences in
1895 application mode, which are distinct from the cursor and scrolling key-
1896 pad:
1898 Key Numeric Application
1899 -------------+----------+-------------
1900 Space | SP | SS3 SP
1901 Tab | TAB | SS3 I
1902 Enter | CR | SS3 M
1903 PF1 | SS3 P | SS3 P
1904 PF2 | SS3 Q | SS3 Q
1905 PF3 | SS3 R | SS3 R
1906 PF4 | SS3 S | SS3 S
1907 * (multiply) | * | SS3 j
1908 + (add) | + | SS3 k
1909 , (comma) | , | SS3 l
1910 - (minus) | - | SS3 m
1911 . (period) | . | SS3 n
1912 / (divide) | / | SS3 o
1913 0 | 0 | SS3 p
1914 1 | 1 | SS3 q
1915 2 | 2 | SS3 r
1916 3 | 3 | SS3 s
1917 4 | 4 | SS3 t
1918 5 | 5 | SS3 u
1919 6 | 6 | SS3 v
1920 7 | 7 | SS3 w
1921 8 | 8 | SS3 x
1922 9 | 9 | SS3 y
1923 = (equal) | = | SS3 X
1924 -------------+----------+-------------
1926 The VT220 provides a 6-key editing keypad, which is analogous to that on
1927 the PC keyboard. It is not affected by DECCKM or DECKPNM/DECKPAM:
1929 Key Normal Application
1930 ---------+----------+-------------
1931 Insert | CSI 2 ~ | CSI 2 ~
1932 Delete | CSI 3 ~ | CSI 3 ~
1933 Home | CSI 1 ~ | CSI 1 ~
1934 End | CSI 4 ~ | CSI 4 ~
1935 PageUp | CSI 5 ~ | CSI 5 ~
1936 PageDown | CSI 6 ~ | CSI 6 ~
1937 ---------+----------+-------------
1939 The VT220 provides 8 additional function keys. With a Sun/PC keyboard,
1940 access these keys by Control/F1 for F13, etc.
1942 Key Escape Sequence
1943 ---------+-----------------
1944 F13 | CSI 2 5 ~
1945 F14 | CSI 2 6 ~
1946 F15 | CSI 2 8 ~
1947 F16 | CSI 2 9 ~
1948 F17 | CSI 3 1 ~
1949 F18 | CSI 3 2 ~
1950 F19 | CSI 3 3 ~
1951 F20 | CSI 3 4 ~
1952 ---------+-----------------
1954 VT52-Style Function Keys
1956 A VT52 does not have function keys, but it does have a numeric keypad
1957 and cursor keys. They differ from the other emulations by the prefix.
1958 Also, the cursor keys do not change:
1960 Key Normal/Application
1961 -------------+--------------------
1962 Cursor Up | ESC A
1963 Cursor Down | ESC B
1964 Cursor Right | ESC C
1965 Cursor Left | ESC D
1966 -------------+--------------------
1968 The keypad is similar:
1970 Key Numeric Application
1971 -------------+----------+-------------
1972 Space | SP | ESC ? SP
1973 Tab | TAB | ESC ? I
1974 Enter | CR | ESC ? M
1975 PF1 | ESC P | ESC P
1976 PF2 | ESC Q | ESC Q
1977 PF3 | ESC R | ESC R
1978 PF4 | ESC S | ESC S
1979 * (multiply) | * | ESC ? j
1980 + (add) | + | ESC ? k
1981 , (comma) | , | ESC ? l
1982 - (minus) | - | ESC ? m
1983 . (period) | . | ESC ? n
1984 / (divide) | / | ESC ? o
1985 0 | 0 | ESC ? p
1986 1 | 1 | ESC ? q
1987 2 | 2 | ESC ? r
1988 3 | 3 | ESC ? s
1989 4 | 4 | ESC ? t
1990 5 | 5 | ESC ? u
1991 6 | 6 | ESC ? v
1992 7 | 7 | ESC ? w
1993 8 | 8 | ESC ? x
1994 9 | 9 | ESC ? y
1995 = (equal) | = | ESC ? X
1996 -------------+----------+-------------
1998 Sun-Style Function Keys
2000 The xterm program provides support for Sun keyboards more directly, by a
2001 menu toggle that causes it to send Sun-style function key codes rather
2002 than VT220. Note, however, that the sun and VT100 emulations are not
2003 really compatible. For example, their wrap-margin behavior differs.
2005 Only function keys are altered; keypad and cursor keys are the same.
2006 The emulation responds identically. See the xterm-sun terminfo entry
2007 for details.
2009 HP-Style Function Keys
2011 Similarly, xterm can be compiled to support HP keyboards. See the
2012 xterm-hp terminfo entry for details.
2014 The Alternate Screen Buffer
2016 XTerm maintains two screen buffers. The Normal Screen Buffer allows you
2017 to scroll back to view saved lines of output up to the maximum set by
2018 the saveLines resource. The Alternate Screen Buffer is exactly as large
2019 as the display, contains no additional saved lines. When the Alternate
2020 Screen Buffer is active, you cannot scroll back to view saved lines.
2021 XTerm provides control sequences and menu entries for switching between
2022 the two.
2024 Most full-screen applications use terminfo or termcap to obtain strings
2025 used to start/stop full-screen mode, i.e., smcup and rmcup for terminfo,
2026 or the corresponding ti and te for termcap. The titeInhibit resource
2027 removes the ti and te strings from the TERMCAP string which is set in
2028 the environment for some platforms. That is not done when xterm is
2029 built with terminfo libraries because terminfo does not provide the
2030 whole text of the termcap data in one piece. It would not work for ter-
2031 minfo anyway, since terminfo data is not passed in environment vari-
2032 ables; setting an environment variable in this manner would have no
2033 effect on the application's ability to switch between Normal and Alter-
2034 nate Screen buffers. Instead, the newer private mode controls (such as
2035 1 0 4 9 ) for switching between Normal and Alternate Screen buffers sim-
2036 ply disable the switching. They add other features such as clearing the
2037 display for the same reason: to make the details of switching indepen-
2038 dent of the application that requests the switch.
2040 Bracketed Paste Mode
2042 When bracketed paste mode is set, pasted text is bracketed with control
2043 sequences so that the program can differentiate pasted text from typed-
2044 in text. When bracketed paste mode is set, the program will receive:
2045 ESC [ 2 0 0 ~ ,
2046 followed by the pasted text, followed by
2047 ESC [ 2 0 1 ~ .
2049 Title Modes
2051 The window- and icon-labels can be set or queried using control
2052 sequences. As a VT220-emulator, xterm "should" limit the character
2053 encoding for the corresponding strings to ISO-8859-1. Indeed, it used
2054 to be the case (and was documented) that window titles had to be
2055 ISO-8859-1. This is no longer the case. However, there are many appli-
2056 cations which still assume that titles are set using ISO-8859-1. So
2057 that is the default behavior.
2059 If xterm is running with UTF-8 encoding, it is possible to use window-
2060 and icon-labels encoded using UTF-8. That is because the underlying X
2061 libraries (and many, but not all) window managers support this feature.
2063 The utf8Title X resource setting tells xterm to disable a reconversion
2064 of the title string back to ISO-8859-1, allowing the title strings to be
2065 interpreted as UTF-8. The same feature can be enabled using the title
2066 mode control sequence described in this summary.
2068 Separate from the ability to set the titles, xterm provides the ability
2069 to query the titles, returning them either in ISO-8859-1 or UTF-8. This
2070 choice is available only while xterm is using UTF-8 encoding.
2072 Finally, the characters sent to, or returned by a title control are less
2073 constrained than the rest of the control sequences. To make them more
2074 manageable (and constrained), for use in shell scripts, xterm has an
2075 optional feature which decodes the string from hexadecimal (for setting
2076 titles) or for encoding the title into hexadecimal when querying the
2077 value.
2079 Mouse Tracking
2081 The VT widget can be set to send the mouse position and other informa-
2082 tion on button presses. These modes are typically used by editors and
2083 other full-screen applications that want to make use of the mouse.
2085 There are two sets of mutually exclusive modes:
2087 o mouse protocol
2089 o protocol encoding
2091 The mouse protocols include DEC Locator mode, enabled by the DECELR CSI
2092 Ps ; Ps ' z control sequence, and is not described here (control
2093 sequences are summarized above). The remaining five modes of the mouse
2094 protocols are each enabled (or disabled) by a different parameter in the
2095 "DECSET CSI ? Pm h " or "DECRST CSI ? Pm l " control sequence.
2097 Manifest constants for the parameter values are defined in xcharmouse.h
2098 as follows:
2100 #define SET_X10_MOUSE 9
2101 #define SET_VT200_MOUSE 1000
2102 #define SET_VT200_HIGHLIGHT_MOUSE 1001
2103 #define SET_BTN_EVENT_MOUSE 1002
2104 #define SET_ANY_EVENT_MOUSE 1003
2106 #define SET_FOCUS_EVENT_MOUSE 1004
2108 #define SET_EXT_MODE_MOUSE 1005
2109 #define SET_SGR_EXT_MODE_MOUSE 1006
2110 #define SET_URXVT_EXT_MODE_MOUSE 1015
2112 #define SET_ALTERNATE_SCROLL 1007
2114 The motion reporting modes are strictly xterm extensions, and are not
2115 part of any standard, though they are analogous to the DEC VT200 DECELR
2116 locator reports.
2118 Normally, parameters (such as pointer position and button number) for
2119 all mouse tracking escape sequences generated by xterm encode numeric
2120 parameters in a single character as value+32. For example, ! specifies
2121 the value 1. The upper left character position on the terminal is
2122 denoted as 1,1. This scheme dates back to X10, though the normal mouse-
2123 tracking (from X11) is more elaborate.
2125 X10 compatibility mode
2127 X10 compatibility mode sends an escape sequence only on button press,
2128 encoding the location and the mouse button pressed. It is enabled by
2129 specifying parameter 9 to DECSET. On button press, xterm sends CSI M
2130 CbCxCy (6 characters).
2132 o Cb is button-1, where button is 1, 2 or 3.
2134 o Cx and Cy are the x and y coordinates of the mouse when the button
2135 was pressed.
2137 Normal tracking mode
2139 Normal tracking mode sends an escape sequence on both button press and
2140 release. Modifier key (shift, ctrl, meta) information is also sent. It
2141 is enabled by specifying parameter 1000 to DECSET. On button press or
2142 release, xterm sends CSI M CbCxCy.
2144 o The low two bits of Cb encode button information: 0=MB1 pressed,
2145 1=MB2 pressed, 2=MB3 pressed, 3=release.
2147 o The next three bits encode the modifiers which were down when the
2148 button was pressed and are added together: 4=Shift, 8=Meta, 16=Con-
2149 trol. Note however that the shift and control bits are normally
2150 unavailable because xterm uses the control modifier with mouse for
2151 popup menus, and the shift modifier is used in the default transla-
2152 tions for button events. The Meta modifier recognized by xterm is
2153 the mod1 mask, and is not necessarily the "Meta" key (see
2154 xmodmap(1)).
2156 o Cx and Cy are the x and y coordinates of the mouse event, encoded as
2157 in X10 mode.
2159 Wheel mice
2161 Wheel mice may return buttons 4 and 5. Those buttons are represented by
2162 the same event codes as buttons 1 and 2 respectively, except that 64 is
2163 added to the event code. Release events for the wheel buttons are not
2164 reported. By default, the wheel mouse events are translated to scroll-
2165 back and scroll-forw actions. Those actions normally scroll the whole
2166 window, as if the scrollbar was used. However if Alternate Scroll mode
2167 is set, then cursor up/down controls are sent when the terminal is dis-
2168 playing the Alternate Screen Buffer. The initial state of Alternate
2169 Scroll mode is set using the alternateScroll resource.
2171 Other buttons
2173 Additional buttons are encoded like the wheel mice,
2175 o by adding 64 (for buttons 6 and 7), or
2177 o by adding 128 (for buttons 8 through 11).
2179 Past button 11, the encoding is ambiguous because the same code may cor-
2180 respond to different button/modifier combinations. It is not possible
2181 to use these buttons (6-11) in xterm's translation resource because
2182 their names are not in the X Toolkit's symbol table.
2184 Highlight tracking
2186 Mouse highlight tracking notifies a program of a button press, receives
2187 a range of lines from the program, highlights the region covered by the
2188 mouse within that range until button release, and then sends the program
2189 the release coordinates. It is enabled by specifying parameter 1001 to
2190 DECSET. Highlighting is performed only for button 1, though other but-
2191 ton events can be received.
2193 Warning: use of this mode requires a cooperating program or it will hang
2194 xterm.
2196 On button press, the same information as for normal tracking is gener-
2197 ated; xterm then waits for the program to send mouse tracking informa-
2198 tion. All X events are ignored until the proper escape sequence is
2199 received from the pty: CSI Ps ; Ps ; Ps ; Ps ; Ps T . The parameters
2200 are func, startx, starty, firstrow, and lastrow.
2202 o func is non-zero to initiate highlight tracking and zero to abort.
2204 o startx and starty give the starting x and y location for the high-
2205 lighted region.
2207 o The ending location tracks the mouse, but will never be above row
2208 firstrow and will always be above row lastrow. (The top of the
2209 screen is row 1.)
2211 When the button is released, xterm reports the ending position one of
2212 two ways:
2214 o if the start and end coordinates are the same locations:
2215 CSI t CxCy.
2217 o otherwise:
2218 CSI T CxCyCxCyCxCy.
2219 The parameters are startx, starty, endx, endy, mousex, and mousey.
2221 o startx, starty, endx, and endy give the starting and ending
2222 character positions of the region.
2224 o mousex and mousey give the location of the mouse at button up,
2225 which may not be over a character.
2227 Button-event tracking
2229 Button-event tracking is essentially the same as normal tracking, but
2230 xterm also reports button-motion events. Motion events are reported
2231 only if the mouse pointer has moved to a different character cell. It
2232 is enabled by specifying parameter 1002 to DECSET. On button press or
2233 release, xterm sends the same codes used by normal tracking mode.
2235 o On button-motion events, xterm adds 32 to the event code (the third
2236 character, Cb).
2238 o The other bits of the event code specify button and modifier keys as
2239 in normal mode. For example, motion into cell x,y with button 1
2240 down is reported as CSI M @ CxCy. ( @ = 32 + 0 (button 1) + 32
2241 (motion indicator) ). Similarly, motion with button 3 down is
2242 reported as CSI M B CxCy. ( B = 32 + 2 (button 3) + 32 (motion
2243 indicator) ).
2245 Any-event tracking
2247 Any-event mode is the same as button-event mode, except that all motion
2248 events are reported, even if no mouse button is down. It is enabled by
2249 specifying 1003 to DECSET.
2251 FocusIn/FocusOut
2253 FocusIn/FocusOut can be combined with any of the mouse events since it
2254 uses a different protocol. When set, it causes xterm to send CSI I
2255 when the terminal gains focus, and CSI O when it loses focus.
2257 Extended coordinates
2259 The original X10 mouse protocol limits the Cx and Cy ordinates to 223
2260 (=255 - 32). XTerm supports more than one scheme for extending this
2261 range, by changing the protocol encoding:
2263 UTF-8 (1005)
2264 This enables UTF-8 encoding for Cx and Cy under all tracking
2265 modes, expanding the maximum encodable position from 223 to
2266 2015. For positions less than 95, the resulting output is
2267 identical under both modes. Under extended mouse mode, posi-
2268 tions greater than 95 generate "extra" bytes which will con-
2269 fuse applications which do not treat their input as a UTF-8
2270 stream. Likewise, Cb will be UTF-8 encoded, to reduce confu-
2271 sion with wheel mouse events.
2273 Under normal mouse mode, positions outside (160,94) result in
2274 byte pairs which can be interpreted as a single UTF-8 charac-
2275 ter; applications which do treat their input as UTF-8 will
2276 almost certainly be confused unless extended mouse mode is
2277 active.
2279 This scheme has the drawback that the encoded coordinates will
2280 not pass through luit unchanged, e.g., for locales using non-
2281 UTF-8 encoding.
2283 SGR (1006)
2284 The normal mouse response is altered to use CSI < followed by
2285 semicolon-separated encoded button value, the Cx and Cy ordi-
2286 nates and a final character which is M for button press and m
2287 for button release.
2289 o The encoded button value in this case does not add 32
2290 since that was useful only in the X10 scheme for ensuring
2291 that the byte containing the button value is a printable
2292 code.
2294 o The modifiers are encoded in the same way.
2296 o A different final character is used for button release to
2297 resolve the X10 ambiguity regarding which button was
2298 released.
2300 The highlight tracking responses are also modified to an SGR-
2301 like format, using the same SGR-style scheme and button-encod-
2302 ings.
2304 URXVT (1015)
2305 The normal mouse response is altered to use CSI followed by
2306 semicolon-separated encoded button value, the Cx and Cy ordi-
2307 nates and final character M .
2309 This uses the same button encoding as X10, but printing it as
2310 a decimal integer rather than as a single byte.
2312 However, CSI M can be mistaken for DL (delete lines), while
2313 the highlight tracking CSI T can be mistaken for SD (scroll
2314 down), and the Window manipulation controls. For these rea-
2315 sons, the 1015 control is not recommended; it is not an
2316 improvement over 1005.
2318 Sixel Graphics
2320 If xterm is configured as VT240, VT241, VT330, VT340 or VT382 using the
2321 decTerminalID resource, it supports Sixel Graphics controls, a palleted
2322 bitmap graphics system using sets of six vertical pixels as the basic
2323 element.
2325 CSI Ps c xterm responds to Send Device Attributes (Primary DA) with
2326 these additional codes:
2327 Ps = 4 -> Sixel graphics.
2329 CSI ? Pm h
2330 xterm has these additional private Set Mode values:
2331 Ps = 8 0 -> Sixel scrolling.
2332 Ps = 1 0 7 0 -> use private color registers for each
2333 graphic.
2334 Ps = 8 4 5 2 -> Sixel scrolling leaves cursor to right of
2335 graphic.
2337 DCS Pa ; Pb ; Ph q Ps..Ps ST
2338 See:
2340 http://vt100.net/docs/vt3xx-gp/chapter14.html
2342 The sixel data device control string has three positional
2343 parameters, following the q with sixel data.
2344 Pa -> pixel aspect ratio
2345 Pb -> background color option
2346 Ph -> horizontal grid size (ignored).
2347 Ps -> sixel data
2349 ReGIS Graphics
2351 If xterm is configured as VT125, VT240, VT241, VT330 or VT340 using the
2352 decTerminalID resource, it supports Remote Graphic Instruction Set, a
2353 graphics description language.
2355 CSI Ps c xterm responds to Send Device Attributes (Primary DA) with
2356 these additional codes:
2357 Ps = 3 -> ReGIS graphics.
2359 CSI ? Pm h
2360 xterm has these additional private Set Mode values:
2361 Ps = 1 0 7 0 -> use private color registers for each
2362 graphic.
2364 DCS Pm p Pr..Pr ST
2365 See:
2367 http://vt100.net/docs/vt3xx-gp/chapter1.html
2369 The ReGIS data device control string has one positional param-
2370 eter with four possible values:
2371 Pm = 0 -> resume command, use fullscreen mode.
2372 Pm = 1 -> start new command, use fullscreen mode.
2373 Pm = 2 -> resume command, use command display mode.
2374 Pm = 3 -> start new command, use command display mode.
2376 Tektronix 4014 Mode
2378 Most of these sequences are standard Tektronix 4014 control sequences.
2379 Graph mode supports the 12-bit addressing of the Tektronix 4014. The
2380 major features missing are the write-through and defocused modes. This
2381 document does not describe the commands used in the various Tektronix
2382 plotting modes but does describe the commands to switch modes.
2384 Some of the sequences are specific to xterm. The Tektronix emulation
2385 was added in X10R4 (1986). The VT240, introduced two years earlier,
2386 also supported Tektronix 4010/4014. Unlike xterm, the VT240 documenta-
2387 tion implies (there is an obvious error in section 6.9 "Entering and
2388 Exiting 4010/4014 Mode") that exiting back to ANSI mode is done by
2389 resetting private mode 3 8 (DECTEK) rather than ESC ETX . A real Tek-
2390 tronix 4014 would not respond to either.
2392 BEL Bell (Ctrl-G).
2394 BS Backspace (Ctrl-H).
2396 TAB Horizontal Tab (Ctrl-I).
2398 LF Line Feed or New Line (Ctrl-J).
2400 VT Cursor up (Ctrl-K).
2402 FF Form Feed or New Page (Ctrl-L).
2404 CR Carriage Return (Ctrl-M).
2406 ESC ETX Switch to VT100 Mode (ESC Ctrl-C).
2408 ESC ENQ Return Terminal Status (ESC Ctrl-E).
2410 ESC FF PAGE (Clear Screen) (ESC Ctrl-L).
2412 ESC SO Begin 4015 APL mode (ESC Ctrl-N). This is ignored by xterm.
2414 ESC SI End 4015 APL mode (ESC Ctrl-O). This is ignored by xterm.
2416 ESC ETB COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss).
2417 ETB (end transmission block) is the same as Ctrl-W.
2419 ESC CAN Bypass Condition (ESC Ctrl-X).
2421 ESC SUB GIN mode (ESC Ctrl-Z).
2423 ESC FS Special Point Plot Mode (ESC Ctrl-\).
2425 ESC 8 Select Large Character Set.
2427 ESC 9 Select #2 Character Set.
2429 ESC : Select #3 Character Set.
2431 ESC ; Select Small Character Set.
2433 OSC Ps ; Pt BEL
2434 Set Text Parameters of VT window.
2435 Ps = 0 -> Change Icon Name and Window Title to Pt.
2436 Ps = 1 -> Change Icon Name to Pt.
2437 Ps = 2 -> Change Window Title to Pt.
2438 Ps = 4 6 -> Change Log File to Pt. This is normally dis-
2439 abled by a compile-time option.
2441 ESC ` Normal Z Axis and Normal (solid) Vectors.
2443 ESC a Normal Z Axis and Dotted Line Vectors.
2445 ESC b Normal Z Axis and Dot-Dashed Vectors.
2447 ESC c Normal Z Axis and Short-Dashed Vectors.
2449 ESC d Normal Z Axis and Long-Dashed Vectors.
2451 ESC h Defocused Z Axis and Normal (solid) Vectors.
2453 ESC i Defocused Z Axis and Dotted Line Vectors.
2455 ESC j Defocused Z Axis and Dot-Dashed Vectors.
2457 ESC k Defocused Z Axis and Short-Dashed Vectors.
2459 ESC l Defocused Z Axis and Long-Dashed Vectors.
2461 ESC p Write-Thru Mode and Normal (solid) Vectors.
2463 ESC q Write-Thru Mode and Dotted Line Vectors.
2465 ESC r Write-Thru Mode and Dot-Dashed Vectors.
2467 ESC s Write-Thru Mode and Short-Dashed Vectors.
2469 ESC t Write-Thru Mode and Long-Dashed Vectors.
2471 FS Point Plot Mode (Ctrl-\).
2473 GS Graph Mode (Ctrl-]).
2475 RS Incremental Plot Mode (Ctrl-^ ).
2477 US Alpha Mode (Ctrl-_).
2479 VT52 Mode
2481 Parameters for cursor movement are at the end of the ESC Y escape
2482 sequence. Each ordinate is encoded in a single character as value+32.
2483 For example, ! is 1. The screen coordinate system is 0-based.
2485 ESC < Exit VT52 mode (Enter VT100 mode).
2487 ESC = Enter alternate keypad mode.
2489 ESC > Exit alternate keypad mode.
2491 ESC A Cursor up.
2493 ESC B Cursor down.
2495 ESC C Cursor right.
2497 ESC D Cursor left.
2499 ESC F Enter graphics mode.
2501 ESC G Exit graphics mode.
2503 ESC H Move the cursor to the home position.
2505 ESC I Reverse line feed.
2507 ESC J Erase from the cursor to the end of the screen.
2509 ESC K Erase from the cursor to the end of the line.
2511 ESC Y Ps Ps
2512 Move the cursor to given row and column.
2514 ESC Z Identify.
2515 -> ESC / Z ("I am a VT52.").
2517 Further reading
2518 Technical manuals
2520 Manuals for hardware terminals are more readily available than simi-
2521 larly-detailed documentation for terminal emulators such as aixterm,
2522 shelltool, dtterm.
2524 However long, the technical manuals have problems:
2526 o DEC's manuals did not provide a comprehensive comparison of the fea-
2527 tures in different model.
2529 Peter Sichel's Host Interface Functions Checklist spreadsheet is
2530 useful for noting which model introduced a given feature (although
2531 there are a few apparent errors such as the DECRQSS feature cited
2532 for VT320 whereas the technical manual omits it).
2534 o Sometimes the manuals disagree. For example, DEC's standard docu-
2535 ment (DEC STD 070) for terminals says that DECSCL performs a soft
2536 reset (DECSTR), while the VT420 manual says it does a hard reset
2537 (RIS).
2539 o Sometimes the manuals are simply incorrect. For example, testing a
2540 DEC VT420 in 1996 showed that the documented code for a valid or
2541 invalid response to DECRQSS was reversed.
2543 The VT420 test results were incorporated into vttest program. At
2544 the time, DEC STD 070 was not available, but it also agrees with
2545 vttest. Later, documentation for the DEC VT525 was shown to have
2546 the same flaw.
2548 o Not all details are clear even in DEC STD 070 (which is more than
2549 twice the length of the VT520 programmer's reference manual, and
2550 almost three times longer than the VT420 reference manual). How-
2551 ever, as an internal standards document, DEC STD 070 is more likely
2552 to describe the actual behavior of DEC's terminals than the more
2553 polished user's guides.
2555 That said, here are technical manuals which have been used in developing
2556 xterm. Not all were available initially. In August 1996 for instance,
2557 the technical references were limited to EK-VT220-HR-002 and EK-
2558 VT420-UG.002. Shortly after, Richard Shuford sent a copy of EK-VT3XX-
2559 TP-001. Still later (beginning in 2003), Paul Williams' vt100.net site
2560 provided EK-VT102-UG-003, EK-VT220-RM-002, EK-VT420-RM-002, EK-VT520-RM
2561 A01, EK-VT100-TM-003, and EK-VT102-UG-003. The remaining documents were
2562 found on the bitsavers site.
2564 o DECscope User's Manual.
2565 Digital Equipment Corporation (EK-VT5X-OP-001 1975).
2567 o VT100 Series Video Terminal Technical Manual.
2568 Digital Equipment Corporation (EK-VT100-TM-003, July 1982).
2570 o VT100 User Guide.
2571 Digital Equipment Corporation (EK-VT100-UG-003, June 1981).
2573 o VT102 User Guide.
2574 Digital Equipment Corporation (EK-VT102-UG-003, February 1982).
2576 o VT220 Programmer Pocket Guide.
2577 Digital Equipment Corporation (EK-VT220-HR-002, July 1984).
2579 o VT220 Programmer Reference Manual.
2580 Digital Equipment Corporation (EK-VT220-RM-002, August 1984).
2582 o VT240 Programmer Reference Manual.
2583 Digital Equipment Corporation (EK-VT240-RM-002, October 1984).
2585 o VT330/VT340 Programmer Reference Manual
2586 Volume 1: Text Programming.
2587 Digital Equipment Corporation (EK-VT3XX-TP-001, March 1987).
2589 o VT330/VT340 Programmer Reference Manual
2590 Volume 2: Graphics Programming.
2591 Digital Equipment Corporation (EK-VT3XX-GP-001, March 1987).
2593 o Installing and Using
2594 The VT420 Video Terminal
2595 (North American Model).
2596 Digital Equipment Corporation (EK-VT420-UG.002, February 1990).
2598 o VT420 Programmer Reference Manual.
2599 Digital Equipment Corporation (EK-VT420-RM-002, February 1992).
2601 o VT510 Video Terminal
2602 Programmer Information.
2603 Digital Equipment Corporation (EK-VT510-RM B01, November 1993).
2605 o VT520/VT525 Video Terminal
2606 Programmer Information.
2607 Digital Equipment Corporation (EK-VT520-RM A01, July 1994).
2609 o Digital ANSI-Compliant Printing Protocol
2610 Level 2 Programming Reference Manual
2611 Digital Equipment Corporation (EK-PPLV2-PM B01, August 1994).
2613 o 4014 and 4014-1 Computer Display Terminal
2614 User's Manual.
2615 Tektronix, Inc. (070-1647-00, November 1979).
2617 Standards
2619 The DEC terminal family (VT100 through VT525) is upward-compatible,
2620 using standards plus extensions, e.g., "private modes". Not all com-
2621 monly-used features are standard. For example, scrolling regions are
2622 not found in ECMA-48.
2624 o ECMA-35: Character Code Structure and Extension Techniques
2625 (6th Edition, December 1994).
2627 o ECMA-48: Control Functions for Coded Character Sets
2628 (5th Edition, June 1991).
2630 o DEC STD 070 Video Systems Reference Manual.
2631 Digital Equipment Corporation (A-MN-ELSM070-00-0000 Rev H, December
2632 3, 1991).
2634 Miscellaneous
2636 A few hardware terminals survived into the 1990s only as terminal emula-
2637 tors. Documentation for these and other terminal emulators which have
2638 influenced xterm are generally available only in less-accessible and
2639 less-detailed manual pages.
2641 o XTerm supports control sequences for manipulating its window which
2642 were implemented by Sun's shelltool program. This was part of Sun-
2643 View (SunOS 3.0, 1986). The change-notes for xterm's resize program
2644 in X10.4 (1986) mention its use of these "Sun tty emulation escape
2645 sequences" for resizing the window. The X10.4 xterm program recog-
2646 nized these sequences for resizing the terminal, except for the
2647 iconfig/deiconfy pair. SunView also introduced the SIGWINCH signal,
2648 used by the X10.4 xterm and mentioned in its CHANGES file:
2650 The window size is passed to the operating system via TIOCSWINSZ
2651 (4.3) or TIOCSSIZE (sun). A SIGWINCH signal is sent if the
2652 vtXXX window is resized.
2654 While support for the Sun control-sequences remained in resize, the
2655 next release of xterm (X11R1 in 1987) omitted the code for inter-
2656 preting them.
2658 Later, the SunView program was adapted for the OPEN LOOK environment
2659 introduced 1988-1990.
2661 Still later, in 1995, OPEN LOOK was abandoned in favor of CDE. The
2662 CDE terminal emulator dtterm implemented those controls, with a cou-
2663 ple of additions.
2665 Starting in July 1996, xterm re-implemented those control sequences
2666 (based on the dtterm manual pages) and further extended the group of
2667 window controls.
2669 There were two sets of controls (CSI Ps[ ; Pm ; Pm]t , and OSC
2670 PstextST ) implemented by shelltool, documented in appendix E of
2671 both PHIGS Programming Manual (1992), and the unpublished X Window
2672 System User's Guide (OPEN LOOK Edition) (1995). The CDE program
2673 kept those, and added a few new ones.
2675 Code Sun CDE xterm Description
2676 -----------------------------------------------------------------
2677 CSI 1 t yes yes yes de-iconify
2678 CSI 2 t yes yes yes iconify
2679 CSI 3 t yes yes yes move window to pixel-position
2680 CSI 4 t yes yes yes resize window in pixels
2681 CSI 5 t yes yes yes raise window to front of stack
2682 CSI 6 t yes yes yes raise window to back of stack
2683 CSI 7 t yes yes yes refresh window
2684 CSI 8 t yes yes yes resize window in chars
2685 CSI 9 t - - yes maximize/unmaximize window
2686 CSI 1 0 t - - yes to/from full-screen
2687 CSI 1 1 t yes yes yes report if window is iconified
2688 CSI 1 2 t - - - -
2689 CSI 1 3 t yes yes yes report window position
2690 CSI 1 4 t yes yes yes report window size in pixels
2691 CSI 1 5 t - - yes report screen size in pixels
2692 CSI 1 6 t - - yes report character cell in pixels
2693 CSI 1 7 t - - - -
2694 CSI 1 8 t yes yes yes report window size in chars
2695 CSI 1 9 t - - yes report screen size in chars
2696 CSI 2 0 t - yes yes report icon label
2697 CSI 2 1 t - yes yes report window title
2698 CSI 2 2 t - - yes save window/icon title
2699 CSI 2 3 t - - yes restore window/icon title
2700 CSI 2 4 t - - yes resize window (DECSLPP)
2701 OSC 0 ST - yes yes set window and icon title
2702 OSC 1 ST - yes yes set icon label
2703 OSC 2 ST - yes yes set window title
2704 OSC 3 ST - n/a yes set X server property
2705 OSC I ST yes yes yes set icon to file
2706 OSC l ST yes yes yes set window title
2707 OSC L ST yes yes yes set icon label
2709 Besides the Sun-derived OSC controls for setting window title and
2710 icon label, dtterm also supported the xterm controls for the same
2711 feature.
2713 The CDE source was unavailable for inspection until 2012, so that
2714 clarification of the details of the window operations relied upon
2715 vttest.
2717 o The control sequences for saving/restoring the cursor and for sav-
2718 ing/restoring "DEC Private Mode Values" may appear to be related
2719 (since the "save" controls both end with s ), but that is coinciden-
2720 tal. The latter was introduced in X10.4:
2722 Most Dec Private mode settings can be save away internally using
2723 \E[?ns, where n is the same number to set or reset the Dec
2724 Private mode. The mode can be restored using \E[?nr. This can
2725 be used in termcap for vi, for example, to turn off saving of
2726 lines, but restore whatever the original state was on exit.
2728 while the SCOSC/SCORC pair was added in 1995 by XFree86 (and docu-
2729 mented long afterwards).
2731 o The aixterm manual page gives the format of the control sequence for
2732 foreground and background colors 8-15, but does not specify what
2733 those colors are. That is implied by the description's mention of
2734 HFT:
2736 The aixterm command provides a standard terminal type for
2737 programs that do not interact directly with Enhanced X-Windows.
2738 This command provides an emulation for a VT102 terminal or a
2739 high function terminal (HFT). The VT102 mode is activated by
2740 the -v flag.
2742 Unlike xterm, there are no resource names for the 16 colors, leaving
2743 the reader to assume that the mapping is hard-coded. The control
2744 sequences for colors 8-15 are not specified by ECMA-48, but rather
2745 (as done in other instances by xterm) chosen to not conflict with
2746 current or future standards.