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