ctlseqs.txt revision 6879286f
1 2 3 4 5 6 7 8 9 10 Xterm Control Sequences 11 12 13 Edward Moy 14 University of California, Berkeley 15 16 Revised by 17 18 Stephen Gildea 19 X Consortium (1994) 20 21 Thomas Dickey 22 XFree86 Project (1996-2006) 23 invisible-island.net (2006-2010) 24 25 26 27Definitions 28 29c The literal character c. 30 31C A single (required) character. 32 33Ps A single (usually optional) numeric parameter, composed of one of 34 more digits. 35 36Pm 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 . 39 40Pt A text parameter composed of printable characters. 41 42C1 (8-Bit) Control Characters 43 44The xterm program recognizes both 8-bit and 7-bit control characters. 45It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled. 46The following pairs of 7-bit and 8-bit control characters are equiva- 47lent: 48 49ESC D 50 Index (IND is 0x84). 51ESC E 52 Next Line (NEL is 0x85). 53ESC H 54 Tab Set (HTS is 0x88). 55ESC M 56 Reverse Index (RI is 0x8d). 57ESC N 58 Single Shift Select of G2 Character Set (SS2 is 0x8e). This 59 affects next character only. 60ESC O 61 Single Shift Select of G3 Character Set (SS3 is 0x8f). This 62 affects next character only. 63ESC P 64 Device Control String (DCS is 0x90). 65ESC V 66 Start of Guarded Area (SPA is 0x96). 67ESC W 68 End of Guarded Area (EPA is 0x97). 69ESC X 70 Start of String (SOS is 0x98). 71ESC Z 72 Return Terminal ID (DECID is 0x9a). Obsolete form of CSI c (DA). 73ESC [ 74 Control Sequence Introducer (CSI is 0x9b). 75ESC \ 76 String Terminator (ST is 0x9c). 77ESC ] 78 Operating System Command (OSC is 0x9d). 79ESC ^ 80 Privacy Message (PM is 0x9e). 81ESC _ 82 Application Program Command (APC is 0x9f). 83 84These control characters are used in the vtXXX emulation. 85 86VT100 Mode 87Most of these control sequences are standard VT102 control sequences, 88but there is support for later DEC VT terminals (i.e., VT220, VT320, 89VT420), as well as ISO 6429 and aixterm color controls. The only VT102 90feature not supported is auto-repeat, since the only way X provides for 91this will affect all windows. There are additional control sequences to 92provide xterm-dependent functions, such as the scrollbar or window size. 93Where the function is specified by DEC or ISO 6429, the code assigned to 94it is given in parentheses. The escape codes to designate and invoke 95character sets are specified by ISO 2022; see that document for a dis- 96cussion of character sets. 97 98Single-character functions 99BEL Bell (Ctrl-G). 100BS Backspace (Ctrl-H). 101CR Carriage Return (Ctrl-M). 102ENQ Return Terminal Status (Ctrl-E). Default response is an empty 103 string, but may be overridden by a resource answerbackString. 104FF Form Feed or New Page (NP). Ctrl-L is treated the same as LF. 105LF Line Feed or New Line (NL). (LF is Ctrl-J). 106SI Shift In (Ctrl-O) -> Switch to Standard Character Set. This 107 invokes the G0 character set (the default). 108SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set. This 109 invokes the G1 character set. 110SP Space. 111TAB Horizontal Tab (HT) (Ctrl-I). 112VT Vertical Tab (Ctrl-K). This is treated the same as LF. 113 114Controls beginning with ESC 115This excludes controls where ESC is part of a 7-bit equivalent to 8-bit 116C1 controls, ordered by the final character(s). 117ESC SP F 7-bit controls (S7C1T). 118ESC SP G 8-bit controls (S8C1T). 119ESC SP L Set ANSI conformance level 1 (dpANS X3.134.1). 120ESC SP M Set ANSI conformance level 2 (dpANS X3.134.1). 121ESC SP N Set ANSI conformance level 3 (dpANS X3.134.1). 122ESC # 3 DEC double-height line, top half (DECDHL). 123ESC # 4 DEC double-height line, bottom half (DECDHL). 124ESC # 5 DEC single-width line (DECSWL). 125ESC # 6 DEC double-width line (DECDWL). 126ESC # 8 DEC Screen Alignment Test (DECALN). 127ESC % @ Select default character set. That is ISO 8859-1 (ISO 2022). 128ESC % G Select UTF-8 character set (ISO 2022). 129ESC ( 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 132 VT220 and up: 133 C = 0 -> DEC Special Character and Line Drawing Set. 134 C = A -> United Kingdom (UK). 135 C = B -> United States (USASCII). 136 C = 4 -> Dutch. 137 C = C or 5 -> Finnish. 138 C = R -> French. 139 C = Q -> French Canadian. 140 C = K -> German. 141 C = Y -> Italian. 142 C = E or 6 -> Norwegian/Danish. 143 C = Z -> Spanish. 144 C = H or 7 -> Swedish. 145 C = = -> Swiss. 146ESC ) C Designate G1 Character Set (ISO 2022, VT100). 147 The same character sets apply as for ESC ( C. 148ESC * C Designate G2 Character Set (ISO 2022, VT220). 149 The same character sets apply as for ESC ( C. 150ESC + C Designate G3 Character Set (ISO 2022, VT220). 151 The same character sets apply as for ESC ( C. 152ESC - C Designate G1 Character Set (VT300). 153 The same character sets apply as for ESC ( C. 154ESC . C Designate G2 Character Set (VT300). 155 The same character sets apply as for ESC ( C. 156ESC / C Designate G3 Character Set (VT300). 157 These work for 96-character sets only. 158 C = A -> ISO Latin-1 Supplemental. 159ESC 7 Save Cursor (DECSC). 160ESC 8 Restore Cursor (DECRC). 161ESC = Application Keypad (DECPAM). 162ESC > Normal Keypad (DECPNM). 163ESC F Cursor to lower left corner of screen. This is enabled by the 164 hpLowerleftBugCompat resource. 165ESC c Full Reset (RIS). 166ESC l Memory Lock (per HP terminals). Locks memory above the cur- 167 sor. 168ESC m Memory Unlock (per HP terminals). 169ESC n Invoke the G2 Character Set as GL (LS2). 170ESC o Invoke the G3 Character Set as GL (LS3). 171ESC | Invoke the G3 Character Set as GR (LS3R). 172ESC } Invoke the G2 Character Set as GR (LS2R). 173ESC ~ Invoke the G1 Character Set as GR (LS1R). 174 175Application Program-Control functions 176APC Pt ST None. xterm implements no APC functions; Pt is ignored. Pt 177 need not be printable characters. 178 179Device-Control functions 180DCS Ps; Ps| Pt ST 181 User-Defined Keys (DECUDK). The first parameter: 182 Ps = 0 -> Clear all UDK definitions before starting 183 (default). 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 191 (e.g., F6=17). 192DCS $ q Pt ST 193 Request Status String (DECRQSS). The string following the "q" 194 is one of the following: 195 " q -> DECSCA 196 " p -> DECSCL 197 r -> DECSTBM 198 m -> SGR 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. 202DCS + p Pt ST 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. 208DCS + q Pt ST 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- 220 ter). 221 222Functions using CSI , ordered by the final character(s) 223CSI Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH). 224CSI Ps A Cursor Up Ps Times (default = 1) (CUU). 225CSI Ps B Cursor Down Ps Times (default = 1) (CUD). 226CSI Ps C Cursor Forward Ps Times (default = 1) (CUF). 227CSI Ps D Cursor Backward Ps Times (default = 1) (CUB). 228CSI Ps E Cursor Next Line Ps Times (default = 1) (CNL). 229CSI Ps F Cursor Preceding Line Ps Times (default = 1) (CPL). 230CSI Ps G Cursor Character Absolute [column] (default = [row,1]) (CHA). 231CSI Ps ; Ps H 232 Cursor Position [row;column] (default = [1,1]) (CUP). 233CSI Ps I Cursor Forward Tabulation Ps tab stops (default = 1) (CHT). 234CSI Ps J Erase in Display (ED). 235 Ps = 0 -> Erase Below (default). 236 Ps = 1 -> Erase Above. 237 Ps = 2 -> Erase All. 238 Ps = 3 -> Erase Saved Lines (xterm). 239CSI ? Ps J 240 Erase in Display (DECSED). 241 Ps = 0 -> Selective Erase Below (default). 242 Ps = 1 -> Selective Erase Above. 243 Ps = 2 -> Selective Erase All. 244CSI Ps K Erase in Line (EL). 245 Ps = 0 -> Erase to Right (default). 246 Ps = 1 -> Erase to Left. 247 Ps = 2 -> Erase All. 248CSI ? Ps K 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. 253CSI Ps L Insert Ps Line(s) (default = 1) (IL). 254CSI Ps M Delete Ps Line(s) (default = 1) (DL). 255CSI Ps P Delete Ps Character(s) (default = 1) (DCH). 256CSI Ps S Scroll up Ps lines (default = 1) (SU). 257CSI Ps T Scroll down Ps lines (default = 1) (SD). 258CSI Ps ; Ps ; Ps ; Ps ; Ps T 259 Initiate highlight mouse tracking. Parameters are 260 [func;startx;starty;firstrow;lastrow]. See the section Mouse 261 Tracking. 262CSI > Ps; Ps T 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- 269 mal. 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"). 273CSI Ps X Erase Ps Character(s) (default = 1) (ECH). 274CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). 275CSI Pm ` Character Position Absolute [column] (default = [row,1]) 276 (HPA). 277CSI Ps b Repeat the preceding graphic character Ps times (REP). 278CSI 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. 289 Ps = 2 -> Printer. 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). 296CSI > Ps c 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 301 this to VT100. 302 -> CSI > Pp ; Pv ; Pc c 303 where Pp denotes the terminal type 304 Pp = 0 -> ``VT100''. 305 Pp = 1 -> ``VT220''. 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 309 always zero. 310CSI Pm d Line Position Absolute [row] (default = [1,column]) (VPA). 311CSI Ps ; Ps f 312 Horizontal and Vertical Position [row;column] (default = 313 [1,1]) (HVP). 314CSI Ps g Tab Clear (TBC). 315 Ps = 0 -> Clear Current Column (default). 316 Ps = 3 -> Clear All. 317CSI 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). 322CSI ? Pm h 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- 334 tion Mouse Tracking. 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- 346 RCM). 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 350 compile-time option. 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 371 key. 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 380 resource). 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. 399CSI 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. 403CSI ? Pm i 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. 410CSI 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). 415CSI ? Pm l 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- 436 NRCM). 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 452 (rxvt). 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 461 Delete key. 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 470 resource). 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 482 than the 4 7 mode. 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. 490CSI Pm m Character Attributes (SGR). 491 Ps = 0 -> Normal (default). 492 Ps = 1 -> Bold. 493 Ps = 4 -> Underlined. 494 Ps = 5 -> Blink (appears as Bold). 495 Ps = 7 -> Inverse. 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). 520 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. 541 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 545 default. 546 547 If 88- or 256-color support is compiled, the following apply. 548 Ps = 3 8 ; 5 ; Ps -> Set foreground color to the second 549 Ps. 550 Ps = 4 8 ; 5 ; Ps -> Set background color to the second 551 Ps. 552 553CSI > Ps; Ps m 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 564 initial values. 565CSI Ps n Device Status Report (DSR). 566 Ps = 5 -> Status Report. Result (``OK'') is 567 CSI 0 n 568 Ps = 6 -> Report Cursor Position (CPR) [row;column]. 569 Result is 570 CSI r ; c R 571CSI > Ps n 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- 583 fiers. 584CSI ? Ps n 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. 599CSI > Ps p 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 . 607CSI ! p Soft terminal reset (DECSTR). 608CSI Ps$ p 609 Request ANSI mode (DECRQM). For VT300 and up, reply is 610 CSI Ps; Pm$ p 611 where Ps is the mode number as in RM, and Pm is the mode 612 value: 613 0 - not recognized 614 1 - set 615 2 - reset 616 3 - permanently set 617 4 - permanently reset 618CSI ? Ps$ p 619 Request DEC private mode (DECRQM). For VT300 and up, reply is 620 CSI ? Ps; Pm$ p 621 where Ps is the mode number as in DECSET, Pm is the mode value 622 as in the ANSI DECRQM. 623CSI Ps ; Ps " p 624 Set conformance level (DECSCL). Valid values for the first 625 parameter: 626 Ps = 6 1 -> VT100. 627 Ps = 6 2 -> VT200. 628 Ps = 6 3 -> VT300. 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. 633CSI 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. 641CSI Ps SP q 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. 648CSI Ps " q 649 Select character protection attribute (DECSCA). Valid values 650 for the parameter: 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. 654CSI Ps ; Ps r 655 Set Scrolling Region [top;bottom] (default = full size of win- 656 dow) (DECSTBM). 657CSI ? Pm r 658 Restore DEC Private Mode Values. The value of Ps previously 659 saved is restored. Ps values are the same as for DECSET. 660CSI 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. 664CSI s Save cursor (ANSI.SYS). 665CSI ? Pm s 666 Save DEC Private Mode Values. Ps values are the same as for 667 DECSET. 668CSI Ps ; Ps ; Ps t 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 672 parameters) are: 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- 679 ing order. 680 Ps = 6 -> Lower the xterm window to the bottom of the 681 stacking order. 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 687 size). 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 692 ; x ; y t 693 Ps = 1 4 -> Report xterm window in pixels. Result is CSI 694 4 ; height ; width t 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 700 OSC L label ST 701 Ps = 2 1 -> Report xterm window's title. Result is OSC l 702 label ST 703 Ps = 2 2 ; 0 -> Save xterm icon and window title on 704 stack. 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 708 stack. 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). 712CSI Pt; Pl; Pb; Pr; Ps$ t 713 Reverse Attributes in Rectangular Area (DECRARA), VT400 and 714 up. 715 Pt; Pl; Pb; Pr denotes the rectangle. 716 Ps denotes the attributes to reverse, i.e., 1, 4, 5, 7. 717CSI > Ps; Ps t 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") 725CSI Ps SP t 726 Set warning-bell volume (DECSWBV, VT520). 727 Ps = 0 or 1 -> off. 728 Ps = 2 , 3 or 4 -> low. 729 Ps = 5 , 6 , 7 , or 8 -> high. 730CSI u Restore cursor (ANSI.SYS). 731CSI Ps SP u 732 Set margin-bell volume (DECSMBV, VT520). 733 Ps = 1 -> off. 734 Ps = 2 , 3 or 4 -> low. 735 Ps = 0 , 5 , 6 , 7 , or 8 -> high. 736CSI 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. 742CSI 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. 753CSI 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. 758 Pn = 1 <- no parity. 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. 763 Pn = 0 <- STP flags. 764CSI 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). 768CSI 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. 772CSI Ps ; Pu ' z 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 779 reports. 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. 784CSI Pt; Pl; Pb; Pr$ z 785 Erase Rectangular Area (DECERA), VT400 and up. 786 Pt; Pl; Pb; Pr denotes the rectangle. 787CSI Pm ' { 788 Select Locator Events (DECSLE). 789 Valid values for the first (and any additional parameters) 790 are: 791 Ps = 0 -> only respond to explicit host requests (DECRQLP). 792 (This is default). It also cancels any filter 793 rectangle. 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. 798CSI Pt; Pl; Pb; Pr$ { 799 Selective Erase Rectangular Area (DECSERA), VT400 and up. 800 Pt; Pl; Pb; Pr denotes the rectangle. 801CSI Ps ' | 802 Request Locator Position (DECRQLP). 803 Valid values for the parameter are: 804 Ps = 0 , 1 or omitted -> transmit a single DECLRP locator 805 report. 806 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 812 with a DECEFR. 813 814 -> CSI Pe ; Pb ; Pr ; Pc ; Pp & w 815 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 830 pressed: 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- 838 mal. 839 The ``page'' parameter is not used by xterm, and will be omit- 840 ted. 841 842Operating System Controls 843OSC Ps ; Pt ST 844OSC Ps ; Pt BEL 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 849 and window title. 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- 855 erty 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. 862 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. 868 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: 874 875 Pc = 0 <- resource colorBD (BOLD). 876 Pc = 1 <- resource colorUL (UNDERLINE). 877 Pc = 2 <- resource colorBL (BLINK). 878 Pc = 3 <- resource colorRV (REVERSE). 879 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. 890 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 896 reply. 897 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. 908 909 Ps = 4 6 -> Change Log File to Pt. (This is normally dis- 910 abled by a compile-time option). 911 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 924 resource. 925 926 Ps = 5 1 (reserved for Emacs shell). 927 928 Ps = 5 2 -> Manipulate Selection Data. These controls may 929 be disabled using the allowWindowOps resource. The parameter 930 Pt is parsed as 931 Pc; Pd 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- 941 cations. 942 If the second parameter is a ? , xterm replies to the host 943 with the selection data encoded using the same protocol. 944 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. 951 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 957 OSC 4 control). 958 959 The dynamic colors can also be reset to their default 960 (resource) values: 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. 970 971Privacy Message 972PM Pt ST xterm implements no PM functions; Pt is ignored. Pt need not 973 be printable characters. 974 975Alt and Meta Keys 976Many keyboards have keys labeled "Alt". Few have keys labeled "Meta". 977However, xterm's default translations use the Meta modifier. Common 978keyboard configurations assign the Meta modifier to an "Alt" key. By 979using xmodmap one may have the modifier assigned to a different key, and 980have "real" alt and meta keys. Here is an example: 981 982 ! put meta on mod3 to distinguish it from alt 983 keycode 64 = Alt_L 984 clear mod1 985 add mod1 = Alt_L 986 keycode 115 = Meta_L 987 clear mod3 988 add mod3 = Meta_L 989 990 991The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set) 992can be used to control the way the Meta modifier applies to ordinary 993keys 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. 996 997The table shows the result for a given character "x" with modifiers 998according to the default translations with the resources set on or off. 999This assumes altIsNotMeta is set: 1000 1001 ----------------------------------------------------------- 1002 key altSendsEscape metaSendsEscape result 1003 ----------------------------------------------------------- 1004 x off off x 1005 Meta-x off off shift 1006 Alt-x off off shift 1007 Alt+Meta-x off off shift 1008 x ON off x 1009 Meta-x ON off shift 1010 Alt-x ON off ESC x 1011 Alt+Meta-x ON off ESC shift 1012 x off ON x 1013 Meta-x off ON ESC x 1014 Alt-x off ON shift 1015 Alt+Meta-x off ON ESC shift 1016 x ON ON x 1017 Meta-x ON ON ESC x 1018 Alt-x ON ON ESC x 1019 Alt+Meta-x ON ON ESC x 1020 ----------------------------------------------------------- 1021 1022 1023PC-Style Function Keys 1024If xterm does minimal translation of the function keys, it usually does 1025this with a PC-style keyboard, so PC-style function keys result. Sun 1026keyboards are similar to PC keyboards. Both have cursor and scrolling 1027operations printed on the keypad, which duplicate the smaller cursor and 1028scrolling keypads. 1029 1030X does not predefine NumLock (used for VT220 keyboards) or Alt (used as 1031an extension for the Sun/PC keyboards) as modifiers. These keys are 1032recognized as modifiers when enabled by the numLock resource, or by the 1033"DECSET 1 0 3 5 " control sequence. 1034 1035The cursor keys transmit the following escape sequences depending on the 1036mode specified via the DECCKM escape sequence. 1037 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 -------------------------------------- 1045 1046The home- and end-keys (unlike PageUp and other keys also on the 6-key 1047editing keypad) are considered "cursor keys" by xterm. Their mode is 1048also controlled by the DECCKM escape sequence: 1049 1050 Key Normal Application 1051 ---------------------------------- 1052 Home CSI H SS3 H 1053 End CSI F SS3 F 1054 ---------------------------------- 1055 1056 1057The application keypad transmits the following escape sequences depend- 1058ing on the mode specified via the DECPNM and DECPAM escape sequences. 1059Use the NumLock key to override the application mode. 1060 1061Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are 1062supported by the program. 1063 1064 Key Numeric Application Terminfo Termcap 1065 -------------------------------------------------------------- 1066 Space SP SS3 SP - - 1067 Tab TAB SS3 I - - 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 - - 1074 + (add) + SS3 k - - 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 -------------------------------------------------------------- 1091 1092They also provide 12 function keys, as well as a few other special-pur- 1093pose keys: 1094 1095 Key Escape Sequence 1096 --------------------------- 1097 F1 SS3 P 1098 F2 SS3 Q 1099 F3 SS3 R 1100 F4 SS3 S 1101 F5 CSI 1 5 ~ 1102 F6 CSI 1 7 ~ 1103 F7 CSI 1 8 ~ 1104 F8 CSI 1 9 ~ 1105 F9 CSI 2 0 ~ 1106 F10 CSI 2 1 ~ 1107 F11 CSI 2 3 ~ 1108 F12 CSI 2 4 ~ 1109 --------------------------- 1110 1111 1112Older versions of xterm implement different escape sequences for F1 1113through F4. These can be activated by setting the oldXtermFKeys 1114resource. However, since they do not correspond to any hardware termi- 1115nal, they have been deprecated. (The DEC VT220 reserves F1 through F5 1116for local functions such as Setup). 1117 1118 Key Escape Sequence 1119 --------------------------- 1120 F1 CSI 1 1 ~ 1121 F2 CSI 1 2 ~ 1122 F3 CSI 1 3 ~ 1123 F4 CSI 1 4 ~ 1124 --------------------------- 1125 1126In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is 1127false, xterm recognizes function key modifiers which are parameters 1128appended before the final character of the control sequence. 1129 1130 Code Modifiers 1131 --------------------------------- 1132 2 Shift 1133 3 Alt 1134 4 Shift + Alt 1135 5 Control 1136 6 Shift + Control 1137 7 Alt + Control 1138 8 Shift + Alt + Control 1139 --------------------------------- 1140 1141For example, shift-F5 would be sent as CSI 1 5 ; 2 ~ 1142 1143If the alwaysUseMods resource is set, the Meta modifier also is recog- 1144nized, making parameters 9 through 16. 1145 1146VT220-Style Function Keys 1147However, xterm is most useful as a DEC VT102 or VT220 emulator. Set the 1148sunKeyboard resource to true to force a Sun/PC keyboard to act like a 1149VT220 keyboard. 1150 1151The VT102/VT220 application keypad transmits unique escape sequences in 1152application mode, which are distinct from the cursor and scrolling key- 1153pad: 1154 1155 Key Numeric Application 1156 -------------------------------------- 1157 Space SP SS3 SP 1158 Tab TAB SS3 I 1159 Enter CR SS3 M 1160 PF1 SS3 P SS3 P 1161 PF2 SS3 Q SS3 Q 1162 PF3 SS3 R SS3 R 1163 PF4 SS3 S SS3 S 1164 * (multiply) * SS3 j 1165 + (add) + SS3 k 1166 , (comma) , SS3 l 1167 - (minus) - SS3 m 1168 . (period) . SS3 n 1169 / (divide) / SS3 o 1170 0 0 SS3 p 1171 1 1 SS3 q 1172 2 2 SS3 r 1173 3 3 SS3 s 1174 4 4 SS3 t 1175 5 5 SS3 u 1176 6 6 SS3 v 1177 7 7 SS3 w 1178 8 8 SS3 x 1179 9 9 SS3 y 1180 = (equal) = SS3 X 1181 -------------------------------------- 1182 1183The VT220 provides a 6-key editing keypad, which is analogous to that on 1184the PC keyboard. It is not affected by DECCKM or DECPNM/DECPAM: 1185 1186 Key Normal Application 1187 ---------------------------------- 1188 Insert CSI 2 ~ CSI 2 ~ 1189 Delete CSI 3 ~ CSI 3 ~ 1190 Home CSI 1 ~ CSI 1 ~ 1191 End CSI 4 ~ CSI 4 ~ 1192 PageUp CSI 5 ~ CSI 5 ~ 1193 PageDown CSI 6 ~ CSI 6 ~ 1194 ---------------------------------- 1195 1196The VT220 provides 8 additional function keys. With a Sun/PC keyboard, 1197access these keys by Control/F1 for F13, etc. 1198 1199 Key Escape Sequence 1200 --------------------------- 1201 F13 CSI 2 5 ~ 1202 F14 CSI 2 6 ~ 1203 F15 CSI 2 8 ~ 1204 F16 CSI 2 9 ~ 1205 F17 CSI 3 1 ~ 1206 F18 CSI 3 2 ~ 1207 F19 CSI 3 3 ~ 1208 F20 CSI 3 4 ~ 1209 --------------------------- 1210 1211 1212VT52-Style Function Keys 1213A VT52 does not have function keys, but it does have a numeric keypad 1214and cursor keys. They differ from the other emulations by the prefix. 1215Also, the cursor keys do not change: 1216 1217 Key Normal/Application 1218 ---------------------------------- 1219 Cursor Up ESC A 1220 Cursor Down ESC B 1221 Cursor Right ESC C 1222 Cursor Left ESC D 1223 ---------------------------------- 1224 1225The keypad is similar: 1226 1227 Key Numeric Application 1228 -------------------------------------- 1229 Space SP ESC ? SP 1230 Tab TAB ESC ? I 1231 Enter CR ESC ? M 1232 PF1 ESC P ESC P 1233 PF2 ESC Q ESC Q 1234 PF3 ESC R ESC R 1235 PF4 ESC S ESC S 1236 * (multiply) * ESC ? j 1237 + (add) + ESC ? k 1238 , (comma) , ESC ? l 1239 - (minus) - ESC ? m 1240 . (period) . ESC ? n 1241 / (divide) / ESC ? o 1242 0 0 ESC ? p 1243 1 1 ESC ? q 1244 2 2 ESC ? r 1245 3 3 ESC ? s 1246 4 4 ESC ? t 1247 5 5 ESC ? u 1248 6 6 ESC ? v 1249 7 7 ESC ? w 1250 8 8 ESC ? x 1251 9 9 ESC ? y 1252 = (equal) = ESC ? X 1253 -------------------------------------- 1254 1255 1256Sun-Style Function Keys 1257The xterm program provides support for Sun keyboards more directly, by a 1258menu toggle that causes it to send Sun-style function key codes rather 1259than VT220. Note, however, that the sun and VT100 emulations are not 1260really compatible. For example, their wrap-margin behavior differs. 1261 1262Only function keys are altered; keypad and cursor keys are the same. 1263The emulation responds identically. See the xterm-sun terminfo entry 1264for details. 1265 1266HP-Style Function Keys 1267Similarly, xterm can be compiled to support HP keyboards. See the 1268xterm-hp terminfo entry for details. 1269 1270The Alternate Screen Buffer 1271Xterm maintains two screen buffers. The normal screen buffer allows you 1272to scroll back to view saved lines of output up to the maximum set by 1273the saveLines resource. The alternate screen buffer is exactly as large 1274as the display, contains no additional saved lines. When the alternate 1275screen buffer is active, you cannot scroll back to view saved lines. 1276Xterm provides control sequences and menu entries for switching between 1277the two. 1278 1279Most full-screen applications use terminfo or termcap to obtain strings 1280used to start/stop full-screen mode, i.e., smcup and rmcup for terminfo, 1281or the corresponding ti and te for termcap. The titeInhibit resource 1282removes the ti and te strings from the TERMCAP string which is set in 1283the environment for some platforms. That is not done when xterm is 1284built with terminfo libraries because terminfo does not provide the 1285whole text of the termcap data in one piece. It would not work for ter- 1286minfo anyway, since terminfo data is not passed in environment vari- 1287ables; setting an environment variable in this manner would have no 1288effect on the application's ability to switch between normal and alter- 1289nate screen buffers. Instead, the newer private mode controls (such as 12901 0 4 9 ) for switching between normal and alternate screen buffers sim- 1291ply disable the switching. They add other features such as clearing the 1292display for the same reason: to make the details of switching indepen- 1293dent of the application that requests the switch. 1294 1295Bracketed Paste Mode 1296When bracketed paste mode is set, pasted text is bracketed with control 1297sequences so that the program can differentiate pasted text from typed- 1298in text. When bracketed paste mode is set, the program will receive: 1299 ESC [ 200 ~, 1300followed by the pasted text, followed by 1301 ESC [ 201 ~. 1302 1303Title Modes 1304The window- and icon-labels can be set or queried using control 1305sequences. As a VT220-emulator, xterm "should" limit the character 1306encoding for the corresponding strings to ISO-8859-1. Indeed, it used 1307to be the case (and was documented) that window titles had to be 1308ISO-8859-1. This is no longer the case. However, there are many appli- 1309cations which still assume that titles are set using ISO-8859-1. So 1310that is the default behavior. 1311 1312If xterm is running with UTF-8 encoding, it is possible to use window- 1313and icon-labels encoded using UTF-8. That is because the underlying X 1314libraries (and many, but not all) window managers support this feature. 1315 1316The utf8Title X resource setting tells xterm to disable a reconversion 1317of the title string back to ISO-8859-1, allowing the title strings to be 1318interpreted as UTF-8. The same feature can be enabled using the title 1319mode control sequence described in this summary. 1320 1321Separate from the ability to set the titles, xterm provides the ability 1322to query the titles, returning them either in ISO-8859-1 or UTF-8. This 1323choice is available only while xterm is using UTF-8 encoding. 1324 1325Finally, the characters sent to, or returned by a title control are less 1326constrained than the rest of the control sequences. To make them more 1327manageable (and constrained), for use in shell scripts, xterm has an 1328optional feature which decodes the string from hexadecimal (for setting 1329titles) or for encoding the title into hexadecimal when querying the 1330value. 1331 1332Mouse Tracking 1333The VT widget can be set to send the mouse position and other informa- 1334tion on button presses. These modes are typically used by editors and 1335other full-screen applications that want to make use of the mouse. 1336 1337There are six mutually exclusive modes. One is DEC Locator mode, 1338enabled by the DECELR CSI Ps ; Ps ' z control sequence, and is not 1339described here (control sequences are summarized above). The remaining 1340five modes are each enabled (or disabled) by a different parameter in 1341the "DECSET CSI ? Pm h " or "DECRST CSI ? Pm l " control sequence. 1342 1343Manifest constants for the parameter values are defined in xcharmouse.h 1344as follows: 1345 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 1351 1352 #define SET_FOCUS_EVENT_MOUSE 1004 1353 1354 #define SET_EXT_MODE_MOUSE 1005 1355 1356The motion reporting modes are strictly xterm extensions, and are not 1357part of any standard, though they are analogous to the DEC VT200 DECELR 1358locator reports. 1359 1360Parameters (such as pointer position and button number) for all mouse 1361tracking escape sequences generated by xterm encode numeric parameters 1362in a single character as value+32. For example, ! specifies the value 13631. The upper left character position on the terminal is denoted as 1,1. 1364 1365X10 compatibility mode sends an escape sequence only on button press, 1366encoding the location and the mouse button pressed. It is enabled by 1367specifying parameter 9 to DECSET. On button press, xterm sends CSI M 1368CbCxCy (6 characters). 1369o Cb is button-1. 1370o Cx and Cy are the x and y coordinates of the mouse when the button 1371 was pressed. 1372 1373Normal tracking mode sends an escape sequence on both button press and 1374release. Modifier key (shift, ctrl, meta) information is also sent. It 1375is enabled by specifying parameter 1000 to DECSET. On button press or 1376release, xterm sends CSI M CbCxCy. 1377o The low two bits of Cb encode button information: 0=MB1 pressed, 1378 1=MB2 pressed, 2=MB3 pressed, 3=release. 1379o 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). 1386o Cx and Cy are the x and y coordinates of the mouse event, encoded as 1387 in X10 mode. 1388 1389Wheel mice may return buttons 4 and 5. Those buttons are represented by 1390the same event codes as buttons 1 and 2 respectively, except that 64 is 1391added to the event code. Release events for the wheel buttons are not 1392reported. 1393 1394Mouse highlight tracking notifies a program of a button press, receives 1395a range of lines from the program, highlights the region covered by the 1396mouse within that range until button release, and then sends the program 1397the release coordinates. It is enabled by specifying parameter 1001 to 1398DECSET. Highlighting is performed only for button 1, though other but- 1399ton events can be received. 1400 1401Warning: use of this mode requires a cooperating program or it will hang 1402xterm. 1403 1404On button press, the same information as for normal tracking is gener- 1405ated; xterm then waits for the program to send mouse tracking informa- 1406tion. All X events are ignored until the proper escape sequence is 1407received from the pty: CSI Ps ; Ps ; Ps ; Ps ; Ps T . The parameters 1408are func, startx, starty, firstrow, and lastrow. func is non-zero to 1409initiate highlight tracking and zero to abort. startx and starty give 1410the starting x and y location for the highlighted region. The ending 1411location tracks the mouse, but will never be above row firstrow and will 1412always be above row lastrow. (The top of the screen is row 1.) When 1413the button is released, xterm reports the ending position one of two 1414ways: 1415o if the start and end coordinates are the same locations: 1416 CSI t CxCy. 1417o otherwise: 1418 CSI T CxCyCxCyCxCy. 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. 1424 1425Button-event tracking is essentially the same as normal tracking, but 1426xterm also reports button-motion events. Motion events are reported 1427only if the mouse pointer has moved to a different character cell. It 1428is enabled by specifying parameter 1002 to DECSET. On button press or 1429release, xterm sends the same codes used by normal tracking mode. 1430o On button-motion events, xterm adds 32 to the event code (the third 1431 character, Cb). 1432o 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 1437 indicator) ). 1438 1439Any-event mode is the same as button-event mode, except that all motion 1440events are reported, even if no mouse button is down. It is enabled by 1441specifying 1003 to DECSET. 1442 1443FocusIn/FocusOut can be combined with any of the mouse events since it 1444uses a different protocol. When set, it causes xterm to send CSI I 1445when the terminal gains focus, and CSI O when it loses focus. 1446 1447Extended mouse mode enables UTF-8 encoding for Cx and Cy under all 1448tracking modes, expanding the maximum encodable position from 223 to 14492015. For positions less than 95, the resulting output is identical 1450under both modes. Under extended mouse mode, positions greater than 95 1451generate "extra" bytes which will confuse applications which do not 1452treat their input as a UTF-8 stream. 1453 1454NOTE: Under normal mouse mode, positions outside (160,94) result in byte 1455pairs which can be interpreted as a single UTF-8 character; applications 1456which do treat their input as UTF-8 will almost certainly be confused 1457unless extended mouse mode is active. 1458 1459Tektronix 4014 Mode 1460Most of these sequences are standard Tektronix 4014 control sequences. 1461Graph mode supports the 12-bit addressing of the Tektronix 4014. The 1462major features missing are the write-through and defocused modes. This 1463document does not describe the commands used in the various Tektronix 1464plotting modes but does describe the commands to switch modes. 1465 1466BEL Bell (Ctrl-G). 1467BS Backspace (Ctrl-H). 1468TAB Horizontal Tab (Ctrl-I). 1469LF Line Feed or New Line (Ctrl-J). 1470VT Cursor up (Ctrl-K). 1471FF Form Feed or New Page (Ctrl-L). 1472CR Carriage Return (Ctrl-M). 1473ESC ETX Switch to VT100 Mode (ESC Ctrl-C). 1474ESC ENQ Return Terminal Status (ESC Ctrl-E). 1475ESC FF PAGE (Clear Screen) (ESC Ctrl-L). 1476ESC SO Begin 4015 APL mode (ESC Ctrl-N). (This is ignored by xterm). 1477ESC SI End 4015 APL mode (ESC Ctrl-O). (This is ignored by xterm). 1478ESC ETB COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss). 1479 ETB (end transmission block) is the same as Ctrl-W. 1480ESC CAN Bypass Condition (ESC Ctrl-X). 1481ESC SUB GIN mode (ESC Ctrl-Z). 1482ESC FS Special Point Plot Mode (ESC Ctrl-\). 1483ESC 8 Select Large Character Set. 1484ESC 9 Select #2 Character Set. 1485ESC : Select #3 Character Set. 1486ESC ; Select Small Character Set. 1487OSC Ps ; Pt BEL 1488 Set Text Parameters of VT window. 1489 Ps = 0 -> Change Icon Name and Window Title to Pt. 1490 Ps = 1 -> Change Icon Name to Pt. 1491 Ps = 2 -> Change Window Title to Pt. 1492 Ps = 4 6 -> Change Log File to Pt. (This is normally dis- 1493 abled by a compile-time option). 1494ESC ` Normal Z Axis and Normal (solid) Vectors. 1495ESC a Normal Z Axis and Dotted Line Vectors. 1496ESC b Normal Z Axis and Dot-Dashed Vectors. 1497ESC c Normal Z Axis and Short-Dashed Vectors. 1498ESC d Normal Z Axis and Long-Dashed Vectors. 1499ESC h Defocused Z Axis and Normal (solid) Vectors. 1500ESC i Defocused Z Axis and Dotted Line Vectors. 1501ESC j Defocused Z Axis and Dot-Dashed Vectors. 1502ESC k Defocused Z Axis and Short-Dashed Vectors. 1503ESC l Defocused Z Axis and Long-Dashed Vectors. 1504ESC p Write-Thru Mode and Normal (solid) Vectors. 1505ESC q Write-Thru Mode and Dotted Line Vectors. 1506ESC r Write-Thru Mode and Dot-Dashed Vectors. 1507ESC s Write-Thru Mode and Short-Dashed Vectors. 1508ESC t Write-Thru Mode and Long-Dashed Vectors. 1509FS Point Plot Mode (Ctrl-\). 1510GS Graph Mode (Ctrl-]). 1511RS Incremental Plot Mode (Ctrl-^). 1512US Alpha Mode (Ctrl-_). 1513 1514VT52 Mode 1515Parameters for cursor movement are at the end of the ESC Y escape 1516sequence. Each ordinate is encoded in a single character as value+32. 1517For example, ! is 1. The screen coordinate system is 0-based. 1518 1519ESC A Cursor up. 1520ESC B Cursor down. 1521ESC C Cursor right. 1522ESC D Cursor left. 1523ESC F Enter graphics mode. 1524ESC G Exit graphics mode. 1525ESC H Move the cursor to the home position. 1526ESC I Reverse line feed. 1527ESC J Erase from the cursor to the end of the screen. 1528ESC K Erase from the cursor to the end of the line. 1529ESC Y Ps Ps 1530 Move the cursor to given row and column. 1531ESC Z Identify. 1532 -> ESC / Z (``I am a VT52.''). 1533ESC = Enter alternate keypad mode. 1534ESC > Exit alternate keypad mode. 1535ESC < Exit VT52 mode (Enter VT100 mode). 1536