ctlseqs.txt revision 4419d26b
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-2021) 24 updated for XTerm Patch #371 (2021/12/26) 25 26 27 28 29Definitions 30 31Many controls use parameters, shown in italics. If a control uses a 32single parameter, only one parameter name is listed. Some parameters 33(along with separating ; characters) may be optional. Other characters 34in the control are required. 35 36C A single (required) character. 37 38Ps A single (usually optional) numeric parameter, composed of one or 39 more digits. 40 41Pm Any number of single numeric parameters, separated by ; 42 character(s). Individual values for the parameters are listed with 43 Ps . 44 45Pt A text parameter composed of printable characters. 46 47 48Control Bytes, Characters, and Sequences 49 50ECMA-48 (aka "ISO 6429") documents C1 (8-bit) and C0 (7-bit) codes. 51Those are respectively codes 128 to 159 and 0 to 31. ECMA-48 avoids 52referring to these codes as characters, because that term is associated 53with graphic characters. Instead, it uses "bytes" and "codes", with 54occasional lapses to "characters" where the meaning cannot be mistaken. 55 56Controls (including the escape code 27) are processed once: 57 58o This means that a C1 control can be mistaken for badly-formed UTF-8 59 when the terminal runs in UTF-8 mode because C1 controls are valid 60 continuation bytes of a UTF-8 encoded (multibyte) value. 61 62o It is not possible to use a C1 control obtained from decoding the 63 UTF-8 text, because that would require reprocessing the data. 64 Consequently there is no ambiguity in the way this document uses the 65 term "character" to refer to bytes in a control sequence. 66 67The order of processing is a necessary consequence of the way ECMA-48 is 68designed: 69 70o Each byte sent to the terminal can be unambiguously determined to 71 fall into one of a few categories (C0, C1 and graphic characters). 72 73o ECMA-48 is modal; once it starts processing a control sequence, the 74 terminal continues until the sequence is complete, or some byte is 75 found which is not allowed in the sequence. 76 77o Intermediate, parameter and final bytes may use the same codes as 78 graphic characters, but they are processed as part of a control 79 sequence and are not actually graphic characters. 80 81o Eight-bit controls can have intermediate, etc., bytes in the range 82 160 to 255. Those can be treated as their counterparts in the range 83 32 to 127. 84 85o Single-byte controls can be handled separately from multi-byte 86 control sequences because ECMA-48's rules are unambiguous. 87 88 As a special case, ECMA-48 (section 9) mentions that the control 89 functions shift-in and shift-out are allowed to occur within a 7-bit 90 multibyte control sequence because those cannot alter the meaning of 91 the control sequence. 92 93o Some controls (such as OSC ) introduce a string mode, which is ended 94 on a ST (string terminator). 95 96 ECMA-48 describes only correct behavior, telling what types of 97 characters are expected at each stage of the control sequences. It 98 says that the action taken in error recovery is implementation- 99 dependent. XTerm decodes control sequences using a state machine. 100 It handles errors in decoding i.e., unexpected characters, by 101 resetting to the initial (ground) state. That is different from the 102 treatment of unimplemented (but correctly formatted) features. 103 104 If an application does not send the string terminator, that is also 105 an error from the standpoint of a user. To accommodate users of 106 those applications, xterm has resource settings which allow 107 workarounds: 108 109 o The Linux console's palette sequences do not use a string 110 terminator. The brokenLinuxOSC resource setting tells xterm to 111 ignore those particular sequences. 112 113 o The terminal should accept single-byte controls within the 114 string. But some applications omit a string terminator, like 115 the Linux console. The brokenStringTerm resource setting tells 116 xterm to exit string mode if it decodes a common control 117 character such as carriage return before the string terminator. 118 119 120C1 (8-Bit) Control Characters 121 122The xterm program recognizes both 8-bit and 7-bit control characters. 123It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled. 124The following pairs of 7-bit and 8-bit control characters are 125equivalent: 126 127ESC D 128 Index (IND is 0x84). 129 130ESC E 131 Next Line (NEL is 0x85). 132 133ESC H 134 Tab Set (HTS is 0x88). 135 136ESC M 137 Reverse Index (RI is 0x8d). 138 139ESC N 140 Single Shift Select of G2 Character Set (SS2 is 0x8e), VT220. 141 This affects next character only. 142 143ESC O 144 Single Shift Select of G3 Character Set (SS3 is 0x8f), VT220. 145 This affects next character only. 146 147ESC P 148 Device Control String (DCS is 0x90). 149 150ESC V 151 Start of Guarded Area (SPA is 0x96). 152 153ESC W 154 End of Guarded Area (EPA is 0x97). 155 156ESC X 157 Start of String (SOS is 0x98). 158 159ESC Z 160 Return Terminal ID (DECID is 0x9a). Obsolete form of CSI c (DA). 161 162ESC [ 163 Control Sequence Introducer (CSI is 0x9b). 164 165ESC \ 166 String Terminator (ST is 0x9c). 167 168ESC ] 169 Operating System Command (OSC is 0x9d). 170 171ESC ^ 172 Privacy Message (PM is 0x9e). 173 174ESC _ 175 Application Program Command (APC is 0x9f). 176 177 178These control characters are used in the vtXXX emulation. 179 180 181VT100-related terminals 182 183In this document, "VT100" refers not only to VT100/VT102, but also to 184the succession of upward-compatible terminals produced by DEC (Digital 185Equipment Corporation) from the mid-1970s for about twenty years. For 186brevity, the document refers to the related models: 187 "VT200" as VT220/VT240, 188 "VT300" as VT320/VT340, 189 "VT400" as VT420, and 190 "VT500" as VT510/VT520/VT525. 191 192Most of these control sequences are standard VT102 control sequences, 193but there is support for later DEC VT terminals (i.e., VT220, VT320, 194VT420, VT510), as well as ECMA-48 and aixterm color controls. The only 195VT102 feature not supported is auto-repeat, since the only way X 196provides for this will affect all windows. 197 198There are additional control sequences to provide xterm-dependent 199functions, such as the scrollbar or window size. Where the function is 200specified by DEC or ECMA-48, the mnemonic assigned to it is given in 201parentheses. 202 203The escape codes to designate and invoke character sets are specified by 204ISO 2022 (see that document for a discussion of character sets). 205 206Many of the features are optional; xterm can be configured and built 207without support for them. 208 209 210VT100 Mode 211 212 213Single-character functions 214 215BEL Bell (BEL is Ctrl-G). 216 217BS Backspace (BS is Ctrl-H). 218 219CR Carriage Return (CR is Ctrl-M). 220 221ENQ Return Terminal Status (ENQ is Ctrl-E). Default response is 222 an empty string, but may be overridden by a resource 223 answerbackString. 224 225FF Form Feed or New Page (NP ). (FF is Ctrl-L). FF is treated 226 the same as LF . 227 228LF Line Feed or New Line (NL). (LF is Ctrl-J). 229 230SI Switch to Standard Character Set (Ctrl-O is Shift In or LS0). 231 This invokes the G0 character set (the default) as GL. 232 VT200 and up implement LS0. 233 234SO Switch to Alternate Character Set (Ctrl-N is Shift Out or 235 LS1). This invokes the G1 character set as GL. 236 VT200 and up implement LS1. 237 238SP Space. 239 240TAB Horizontal Tab (HTS is Ctrl-I). 241 242VT Vertical Tab (VT is Ctrl-K). This is treated the same as LF. 243 244 245Controls beginning with ESC 246 247This excludes controls where ESC is part of a 7-bit equivalent to 8-bit 248C1 controls, ordered by the final character(s). 249 250ESC SP F 7-bit controls (S7C1T), VT220. This tells the terminal to 251 send C1 control characters as 7-bit sequences, e.g., its 252 responses to queries. DEC VT200 and up always accept 8-bit 253 control sequences except when configured for VT100 mode. 254 255ESC SP G 8-bit controls (S8C1T), VT220. This tells the terminal to 256 send C1 control characters as 8-bit sequences, e.g., its 257 responses to queries. DEC VT200 and up always accept 8-bit 258 control sequences except when configured for VT100 mode. 259 260ESC SP L Set ANSI conformance level 1, ECMA-43. 261 262ESC SP M Set ANSI conformance level 2, ECMA-43. 263 264ESC SP N Set ANSI conformance level 3, ECMA-43. 265 266ESC # 3 DEC double-height line, top half (DECDHL), VT100. 267 268ESC # 4 DEC double-height line, bottom half (DECDHL), VT100. 269 270ESC # 5 DEC single-width line (DECSWL), VT100. 271 272ESC # 6 DEC double-width line (DECDWL), VT100. 273 274ESC # 8 DEC Screen Alignment Test (DECALN), VT100. 275 276ESC % @ Select default character set. That is ISO 8859-1 (ISO 2022). 277 278ESC % G Select UTF-8 character set, ISO 2022. 279 280ESC ( C Designate G0 Character Set, VT100, ISO 2022. 281 Final character C for designating 94-character sets. In this 282 list, 283 o 0 , A and B were introduced in the VT100, 284 o most were introduced in the VT200 series, 285 o a few were introduced in the VT300 series, and 286 o a few more were introduced in the VT500 series. 287 The VT220 character sets, together with a few others (such as 288 Portuguese) are activated by the National Replacement 289 Character Set (NRCS) controls. The term "replacement" says 290 that the character set is formed by replacing some of the 291 characters in a set (termed the Multinational Character Set) 292 with more useful ones for a given language. The ASCII and DEC 293 Supplemental character sets make up the two halves of the 294 Multinational Character set, initially mapped to GL and GR. 295 The valid final characters C for this control are: 296 C = A -> United Kingdom (UK), VT100. 297 C = B -> United States (USASCII), VT100. 298 C = C or 5 -> Finnish, VT200. 299 C = H or 7 -> Swedish, VT200. 300 C = K -> German, VT200. 301 C = Q or 9 -> French Canadian, VT200. 302 C = R or f -> French, VT200. 303 C = Y -> Italian, VT200. 304 C = Z -> Spanish, VT200. 305 C = 4 -> Dutch, VT200. 306 C = " > -> Greek, VT500. 307 C = % 2 -> Turkish, VT500. 308 C = % 6 -> Portuguese, VT300. 309 C = % = -> Hebrew, VT500. 310 C = = -> Swiss, VT200. 311 C = ` , E or 6 -> Norwegian/Danish, VT200. 312 The final character A is a special case, since the same final 313 character is used by the VT300-control for the 96-character 314 British Latin-1. 315 There are a few other 94-character sets: 316 C = 0 -> DEC Special Character and Line Drawing Set, VT100. 317 C = < -> DEC Supplemental, VT200. 318 C = > -> DEC Technical, VT300. 319 These are documented as 94-character sets (like USASCII) 320 without NRCS: 321 C = " 4 -> DEC Hebrew, VT500. 322 C = " ? -> DEC Greek, VT500. 323 C = % 0 -> DEC Turkish, VT500. 324 C = % 5 -> DEC Supplemental Graphics, VT300. 325 C = & 4 -> DEC Cyrillic, VT500. 326 The VT520 reference manual lists a few more, but no 327 documentation has been found for the mappings: 328 C = % 3 -> SCS NRCS, VT500. 329 C = & 5 -> DEC Russian, VT500. 330 331ESC ) C Designate G1 Character Set, ISO 2022, VT100. 332 The same character sets apply as for ESC ( C. 333 334ESC * C Designate G2 Character Set, ISO 2022, VT220. 335 The same character sets apply as for ESC ( C. 336 337ESC + C Designate G3 Character Set, ISO 2022, VT220. 338 The same character sets apply as for ESC ( C. 339 340ESC - C Designate G1 Character Set, VT300. 341 These controls apply only to 96-character sets. Unlike the 342 94-character sets, these can have different values than ASCII 343 space and DEL for the mapping of 0x20 and 0x7f. The valid 344 final characters C for this control are: 345 C = A -> ISO Latin-1 Supplemental, VT300. 346 C = B -> ISO Latin-2 Supplemental, VT500. 347 C = F -> ISO Greek Supplemental, VT500. 348 C = H -> ISO Hebrew Supplemental, VT500. 349 C = L -> ISO Latin-Cyrillic, VT500. 350 C = M -> ISO Latin-5 Supplemental, VT500. 351 352ESC . C Designate G2 Character Set, VT300. 353 The same character sets apply as for ESC - C. 354 355ESC / C Designate G3 Character Set, VT300. 356 The same character sets apply as for ESC - C. 357 358ESC 6 Back Index (DECBI), VT420 and up. 359 360ESC 7 Save Cursor (DECSC), VT100. 361 362ESC 8 Restore Cursor (DECRC), VT100. 363 364ESC 9 Forward Index (DECFI), VT420 and up. 365 366ESC = Application Keypad (DECKPAM). 367 368ESC > Normal Keypad (DECKPNM), VT100. 369 370ESC F Cursor to lower left corner of screen. This is enabled by the 371 hpLowerleftBugCompat resource. 372 373ESC c Full Reset (RIS), VT100. 374 375ESC l Memory Lock (per HP terminals). Locks memory above the 376 cursor. 377 378ESC m Memory Unlock (per HP terminals). 379 380ESC n Invoke the G2 Character Set as GL (LS2). 381 382ESC o Invoke the G3 Character Set as GL (LS3). 383 384ESC | Invoke the G3 Character Set as GR (LS3R). 385 386ESC } Invoke the G2 Character Set as GR (LS2R). 387 388ESC ~ Invoke the G1 Character Set as GR (LS1R), VT100. 389 390 391Application Program-Command functions 392 393APC Pt ST None. xterm implements no APC functions; Pt is ignored. Pt 394 need not be printable characters. 395 396 397Device-Control functions 398 399DCS Ps ; Ps | Pt ST 400 User-Defined Keys (DECUDK), VT220 and up. 401 402 The first parameter: 403 Ps = 0 -> Clear all UDK definitions before starting 404 (default). 405 Ps = 1 -> Erase Below (default). 406 407 The second parameter: 408 Ps = 0 <- Lock the keys (default). 409 Ps = 1 <- Do not lock. 410 411 The third parameter is a ";"-separated list of strings 412 denoting the key-code separated by a "/" from the hex-encoded 413 key value. The key codes correspond to the DEC function-key 414 codes (e.g., F6=17). 415 416DCS $ q Pt ST 417 Request Status String (DECRQSS), VT420 and up. 418 The string following the "q" is one of the following: 419 m -> SGR 420 " p -> DECSCL 421 SP q -> DECSCUSR 422 " q -> DECSCA 423 r -> DECSTBM 424 s -> DECSLRM 425 t -> DECSLPP 426 $ | -> DECSCPP 427 $ } -> DECSASD 428 $ ~ -> DECSSDT 429 * | -> DECSNLS 430 xterm responds with DCS 1 $ r Pt ST for valid requests, 431 replacing the Pt with the corresponding CSI string, or DCS 0 $ 432 r Pt ST for invalid requests. 433 434DCS Ps $ t Pt ST 435 Restore presentation status (DECRSPS), VT320 and up. The 436 control can be converted from a response from DECCIR or 437 DECTABSR by changing the first "u" to a "t" 438 Ps = 1 -> DECCIR 439 Ps = 2 -> DECTABSR 440 441DCS + Q Pt ST 442 Request resource values (XTGETXRES), xterm. The string 443 following the "Q" is a list of names encoded in hexadecimal (2 444 digits per character) separated by ; which correspond to xterm 445 resource names. Only boolean, numeric and string resources 446 are supported by this query. 447 448 xterm responds with 449 DCS 1 + R Pt ST for valid requests, adding to Pt an = , and 450 the value of the corresponding resource that xterm is using, 451 or 452 DCS 0 + R Pt ST for invalid requests. 453 The strings are encoded in hexadecimal (2 digits per 454 character). 455 456 457DCS + p Pt ST 458 Set Termcap/Terminfo Data (XTSETTCAP), xterm. The string 459 following the "p" is a name to use for retrieving data from 460 the terminal database. The data will be used for the "tcap" 461 keyboard configuration's function- and special-keys, as well 462 as by the Request Termcap/Terminfo String control. 463 464 465DCS + q Pt ST 466 Request Termcap/Terminfo String (XTGETTCAP), xterm. The 467 string following the "q" is a list of names encoded in 468 hexadecimal (2 digits per character) separated by ; which 469 correspond to termcap or terminfo key names. 470 A few special features are also recognized, which are not key 471 names: 472 473 o Co for termcap colors (or colors for terminfo colors), and 474 475 o TN for termcap name (or name for terminfo name). 476 477 o RGB for the ncurses direct-color extension. 478 Only a terminfo name is provided, since termcap 479 applications cannot use this information. 480 481 xterm responds with 482 DCS 1 + r Pt ST for valid requests, adding to Pt an = , and 483 the value of the corresponding string that xterm would send, 484 or 485 DCS 0 + r Pt ST for invalid requests. 486 The strings are encoded in hexadecimal (2 digits per 487 character). 488 489 490Functions using CSI , ordered by the final character(s) 491 492CSI Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH). 493 494CSI Ps SP @ 495 Shift left Ps columns(s) (default = 1) (SL), ECMA-48. 496 497CSI Ps A Cursor Up Ps Times (default = 1) (CUU). 498 499CSI Ps SP A 500 Shift right Ps columns(s) (default = 1) (SR), ECMA-48. 501 502CSI Ps B Cursor Down Ps Times (default = 1) (CUD). 503 504CSI Ps C Cursor Forward Ps Times (default = 1) (CUF). 505 506CSI Ps D Cursor Backward Ps Times (default = 1) (CUB). 507 508CSI Ps E Cursor Next Line Ps Times (default = 1) (CNL). 509 510CSI Ps F Cursor Preceding Line Ps Times (default = 1) (CPL). 511 512CSI Ps G Cursor Character Absolute [column] (default = [row,1]) (CHA). 513 514CSI Ps ; Ps H 515 Cursor Position [row;column] (default = [1,1]) (CUP). 516 517CSI Ps I Cursor Forward Tabulation Ps tab stops (default = 1) (CHT). 518 519CSI Ps J Erase in Display (ED), VT100. 520 Ps = 0 -> Erase Below (default). 521 Ps = 1 -> Erase Above. 522 Ps = 2 -> Erase All. 523 Ps = 3 -> Erase Saved Lines, xterm. 524 525CSI ? Ps J 526 Erase in Display (DECSED), VT220. 527 Ps = 0 -> Selective Erase Below (default). 528 Ps = 1 -> Selective Erase Above. 529 Ps = 2 -> Selective Erase All. 530 Ps = 3 -> Selective Erase Saved Lines, xterm. 531 532CSI Ps K Erase in Line (EL), VT100. 533 Ps = 0 -> Erase to Right (default). 534 Ps = 1 -> Erase to Left. 535 Ps = 2 -> Erase All. 536 537CSI ? Ps K 538 Erase in Line (DECSEL), VT220. 539 Ps = 0 -> Selective Erase to Right (default). 540 Ps = 1 -> Selective Erase to Left. 541 Ps = 2 -> Selective Erase All. 542 543CSI Ps L Insert Ps Line(s) (default = 1) (IL). 544 545CSI Ps M Delete Ps Line(s) (default = 1) (DL). 546 547CSI Ps P Delete Ps Character(s) (default = 1) (DCH). 548 549CSI # P 550CSI Pm # P 551 Push current dynamic- and ANSI-palette colors onto stack 552 (XTPUSHCOLORS), xterm. Parameters (integers in the range 1 553 through 10, since the default 0 will push) may be used to 554 store the palette into the stack without pushing. 555 556CSI # Q 557CSI Pm # Q 558 Pop stack to set dynamic- and ANSI-palette colors 559 (XTPOPCOLORS), xterm. Parameters (integers in the range 1 560 through 10, since the default 0 will pop) may be used to 561 restore the palette from the stack without popping. 562 563CSI # R Report the current entry on the palette stack, and the number 564 of palettes stored on the stack, using the same form as 565 XTPOPCOLOR (default = 0) (XTREPORTCOLORS), xterm. 566 567CSI Ps S Scroll up Ps lines (default = 1) (SU), VT420, ECMA-48. 568 569CSI ? Pi ; Pa ; Pv S 570 Set or request graphics attribute (XTSMGRAPHICS), xterm. If 571 configured to support either Sixel Graphics or ReGIS Graphics, 572 xterm accepts a three-parameter control sequence, where Pi, Pa 573 and Pv are the item, action and value: 574 575 Pi = 1 -> item is number of color registers. 576 Pi = 2 -> item is Sixel graphics geometry (in pixels). 577 Pi = 3 -> item is ReGIS graphics geometry (in pixels). 578 579 Pa = 1 -> read attribute. 580 Pa = 2 -> reset to default. 581 Pa = 3 -> set to value in Pv. 582 Pa = 4 -> read the maximum allowed value. 583 584 Pv is ignored by xterm except when setting (Pa == 3 ). 585 Pv = n <- A single integer is used for color registers. 586 Pv = width ; height <- Two integers for graphics geometry. 587 588 xterm replies with a control sequence of the same form: 589 590 CSI ? Pi ; Ps ; Pv S 591 592 where Ps is the status: 593 Ps = 0 <- success. 594 Ps = 1 <- error in Pi. 595 Ps = 2 <- error in Pa. 596 Ps = 3 <- failure. 597 598 On success, Pv represents the value read or set. 599 600 Notes: 601 o The current implementation allows reading the graphics 602 sizes, but disallows modifying those sizes because that is 603 done once, using resource-values. 604 o Graphics geometry is not necessarily the same as "window 605 size" (see the dtterm window manipulation extensions). 606 XTerm limits the maximum graphics geometry according to 607 the maxGraphicSize resource. 608 The maxGraphicSize resource can be either an explicit 609 heightxwidth (default: 1000x1000 as of version 328) or the 610 word "auto" (telling XTerm to use limits the decGraphicsID 611 or decTerminalID resource to determine the limits). 612 o XTerm uses the minimum of the window size and the graphic 613 size to obtain the maximum geometry. 614 o While resizing a window will always change the current 615 graphics geometry, the reverse is not true. Setting 616 graphics geometry does not affect the window size. 617 o If xterm is able to support graphics (compile-time), but 618 is not configured (runtime) for graphics, these responses 619 will indicate a failure. Other implementations which do 620 not use the maximum graphics dimensions but are configured 621 for graphics should report zeroes for the maximum geometry 622 rather than a failure. 623 624CSI Ps T Scroll down Ps lines (default = 1) (SD), VT420. 625 626CSI Ps ; Ps ; Ps ; Ps ; Ps T 627 Initiate highlight mouse tracking (XTHIMOUSE), xterm. 628 Parameters are [func;startx;starty;firstrow;lastrow]. See the 629 section Mouse Tracking. 630 631CSI > Pm T 632 Reset title mode features to default value (XTRMTITLE), xterm. 633 Normally, "reset" disables the feature. It is possible to 634 disable the ability to reset features by compiling a different 635 default for the title modes into xterm. 636 637 Ps = 0 -> Do not set window/icon labels using hexadecimal. 638 Ps = 1 -> Do not query window/icon labels using 639 hexadecimal. 640 Ps = 2 -> Do not set window/icon labels using UTF-8. 641 Ps = 3 -> Do not query window/icon labels using UTF-8. 642 643 (See discussion of Title Modes). 644 645CSI Ps X Erase Ps Character(s) (default = 1) (ECH). 646 647CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT). 648 649CSI Ps ^ Scroll down Ps lines (default = 1) (SD), ECMA-48. 650 This was a publication error in the original ECMA-48 5th 651 edition (1991) corrected in 2003. 652 653CSI Ps ` Character Position Absolute [column] (default = [row,1]) 654 (HPA). 655 656CSI Ps a Character Position Relative [columns] (default = [row,col+1]) 657 (HPR). 658 659CSI Ps b Repeat the preceding graphic character Ps times (REP). 660 661CSI Ps c Send Device Attributes (Primary DA). 662 Ps = 0 or omitted -> request attributes from terminal. The 663 response depends on the decTerminalID resource setting. 664 -> CSI ? 1 ; 2 c ("VT100 with Advanced Video Option") 665 -> CSI ? 1 ; 0 c ("VT101 with No Options") 666 -> CSI ? 4 ; 6 c ("VT132 with Advanced Video and Graphics") 667 -> CSI ? 6 c ("VT102") 668 -> CSI ? 7 c ("VT131") 669 -> CSI ? 1 2 ; Ps c ("VT125") 670 -> CSI ? 6 2 ; Ps c ("VT220") 671 -> CSI ? 6 3 ; Ps c ("VT320") 672 -> CSI ? 6 4 ; Ps c ("VT420") 673 674 The VT100-style response parameters do not mean anything by 675 themselves. VT220 (and higher) parameters do, telling the 676 host what features the terminal supports: 677 Ps = 1 -> 132-columns. 678 Ps = 2 -> Printer. 679 Ps = 3 -> ReGIS graphics. 680 Ps = 4 -> Sixel graphics. 681 Ps = 6 -> Selective erase. 682 Ps = 8 -> User-defined keys. 683 Ps = 9 -> National Replacement Character sets. 684 Ps = 1 5 -> Technical characters. 685 Ps = 1 6 -> Locator port. 686 Ps = 1 7 -> Terminal state interrogation. 687 Ps = 1 8 -> User windows. 688 Ps = 2 1 -> Horizontal scrolling. 689 Ps = 2 2 -> ANSI color, e.g., VT525. 690 Ps = 2 8 -> Rectangular editing. 691 Ps = 2 9 -> ANSI text locator (i.e., DEC Locator mode). 692 693 XTerm supports part of the User windows feature, providing a 694 single page (which corresponds to its visible window). Rather 695 than resizing the font to change the number of lines/columns 696 in a fixed-size display, xterm uses the window extension 697 controls (DECSNLS, DECSCPP, DECSLPP) to adjust its visible 698 window's size. The "cursor coupling" controls (DECHCCM, 699 DECPCCM, DECVCCM) are ignored. 700 701CSI = Ps c 702 Send Device Attributes (Tertiary DA). 703 Ps = 0 -> report Terminal Unit ID (default), VT400. XTerm 704 uses zeros for the site code and serial number in its DECRPTUI 705 response. 706 707CSI > Ps c 708 Send Device Attributes (Secondary DA). 709 Ps = 0 or omitted -> request the terminal's identification 710 code. The response depends on the decTerminalID resource 711 setting. It should apply only to VT220 and up, but xterm 712 extends this to VT100. 713 -> CSI > Pp ; Pv ; Pc c 714 where Pp denotes the terminal type 715 Pp = 0 -> "VT100". 716 Pp = 1 -> "VT220". 717 Pp = 2 -> "VT240" or "VT241". 718 Pp = 1 8 -> "VT330". 719 Pp = 1 9 -> "VT340". 720 Pp = 2 4 -> "VT320". 721 Pp = 3 2 -> "VT382". 722 Pp = 4 1 -> "VT420". 723 Pp = 6 1 -> "VT510". 724 Pp = 6 4 -> "VT520". 725 Pp = 6 5 -> "VT525". 726 727 and Pv is the firmware version (for xterm, this was originally 728 the XFree86 patch number, starting with 95). In a DEC 729 terminal, Pc indicates the ROM cartridge registration number 730 and is always zero. 731 732CSI Ps d Line Position Absolute [row] (default = [1,column]) (VPA). 733 734CSI Ps e Line Position Relative [rows] (default = [row+1,column]) 735 (VPR). 736 737CSI Ps ; Ps f 738 Horizontal and Vertical Position [row;column] (default = 739 [1,1]) (HVP). 740 741CSI Ps g Tab Clear (TBC). 742 Ps = 0 -> Clear Current Column (default). 743 Ps = 3 -> Clear All. 744 745CSI Pm h Set Mode (SM). 746 Ps = 2 -> Keyboard Action Mode (KAM). 747 Ps = 4 -> Insert Mode (IRM). 748 Ps = 1 2 -> Send/receive (SRM). 749 Ps = 2 0 -> Automatic Newline (LNM). 750 751CSI ? Pm h 752 DEC Private Mode Set (DECSET). 753 Ps = 1 -> Application Cursor Keys (DECCKM), VT100. 754 Ps = 2 -> Designate USASCII for character sets G0-G3 755 (DECANM), VT100, and set VT100 mode. 756 Ps = 3 -> 132 Column Mode (DECCOLM), VT100. 757 Ps = 4 -> Smooth (Slow) Scroll (DECSCLM), VT100. 758 Ps = 5 -> Reverse Video (DECSCNM), VT100. 759 Ps = 6 -> Origin Mode (DECOM), VT100. 760 Ps = 7 -> Auto-Wrap Mode (DECAWM), VT100. 761 Ps = 8 -> Auto-Repeat Keys (DECARM), VT100. 762 Ps = 9 -> Send Mouse X & Y on button press. See the 763 section Mouse Tracking. This is the X10 xterm mouse protocol. 764 Ps = 1 0 -> Show toolbar (rxvt). 765 Ps = 1 2 -> Start blinking cursor (AT&T 610). 766 Ps = 1 3 -> Start blinking cursor (set only via resource or 767 menu). 768 Ps = 1 4 -> Enable XOR of blinking cursor control sequence 769 and menu. 770 Ps = 1 8 -> Print Form Feed (DECPFF), VT220. 771 Ps = 1 9 -> Set print extent to full screen (DECPEX), 772 VT220. 773 Ps = 2 5 -> Show cursor (DECTCEM), VT220. 774 Ps = 3 0 -> Show scrollbar (rxvt). 775 Ps = 3 5 -> Enable font-shifting functions (rxvt). 776 Ps = 3 8 -> Enter Tektronix mode (DECTEK), VT240, xterm. 777 Ps = 4 0 -> Allow 80 -> 132 mode, xterm. 778 Ps = 4 1 -> more(1) fix (see curses resource). 779 Ps = 4 2 -> Enable National Replacement Character sets 780 (DECNRCM), VT220. 781 Ps = 4 3 -> Enable Graphics Expanded Print Mode (DECGEPM). 782 Ps = 4 4 -> Turn on margin bell, xterm. 783 Ps = 4 4 -> Enable Graphics Print Color Mode (DECGPCM). 784 Ps = 4 5 -> Reverse-wraparound mode, xterm. 785 Ps = 4 5 -> Enable Graphics Print ColorSpace (DECGPCS). 786 Ps = 4 6 -> Start logging, xterm. This is normally 787 disabled by a compile-time option. 788 Ps = 4 7 -> Use Alternate Screen Buffer, xterm. This may 789 be disabled by the titeInhibit resource. 790 Ps = 4 7 -> Enable Graphics Rotated Print Mode (DECGRPM). 791 Ps = 6 6 -> Application keypad mode (DECNKM), VT320. 792 Ps = 6 7 -> Backarrow key sends backspace (DECBKM), VT340, 793 VT420. This sets the backarrowKey resource to "true". 794 Ps = 6 9 -> Enable left and right margin mode (DECLRMM), 795 VT420 and up. 796 Ps = 8 0 -> Disable Sixel Scrolling (DECSDM). 797 Ps = 9 5 -> Do not clear screen when DECCOLM is set/reset 798 (DECNCSM), VT510 and up. 799 Ps = 1 0 0 0 -> Send Mouse X & Y on button press and 800 release. See the section Mouse Tracking. This is the X11 801 xterm mouse protocol. 802 Ps = 1 0 0 1 -> Use Hilite Mouse Tracking, xterm. 803 Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking, xterm. See 804 the section Button-event tracking. 805 Ps = 1 0 0 3 -> Use All Motion Mouse Tracking, xterm. See 806 the section Any-event tracking. 807 Ps = 1 0 0 4 -> Send FocusIn/FocusOut events, xterm. 808 Ps = 1 0 0 5 -> Enable UTF-8 Mouse Mode, xterm. 809 Ps = 1 0 0 6 -> Enable SGR Mouse Mode, xterm. 810 Ps = 1 0 0 7 -> Enable Alternate Scroll Mode, xterm. This 811 corresponds to the alternateScroll resource. 812 Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt). 813 This sets the scrollTtyOutput resource to "true". 814 Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt). This 815 sets the scrollKey resource to "true". 816 Ps = 1 0 1 5 -> Enable urxvt Mouse Mode. 817 Ps = 1 0 1 6 -> Enable SGR Mouse PixelMode, xterm. 818 Ps = 1 0 3 4 -> Interpret "meta" key, xterm. This sets the 819 eighth bit of keyboard input (and enables the eightBitInput 820 resource). 821 Ps = 1 0 3 5 -> Enable special modifiers for Alt and 822 NumLock keys, xterm. This enables the numLock resource. 823 Ps = 1 0 3 6 -> Send ESC when Meta modifies a key, xterm. 824 This enables the metaSendsEscape resource. 825 Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete 826 key, xterm. 827 Ps = 1 0 3 9 -> Send ESC when Alt modifies a key, xterm. 828 This enables the altSendsEscape resource, xterm. 829 Ps = 1 0 4 0 -> Keep selection even if not highlighted, 830 xterm. This enables the keepSelection resource. 831 Ps = 1 0 4 1 -> Use the CLIPBOARD selection, xterm. This 832 enables the selectToClipboard resource. 833 Ps = 1 0 4 2 -> Enable Urgency window manager hint when 834 Control-G is received, xterm. This enables the bellIsUrgent 835 resource. 836 Ps = 1 0 4 3 -> Enable raising of the window when Control-G 837 is received, xterm. This enables the popOnBell resource. 838 Ps = 1 0 4 4 -> Reuse the most recent data copied to 839 CLIPBOARD, xterm. This enables the keepClipboard resource. 840 Ps = 1 0 4 6 -> Enable switching to/from Alternate Screen 841 Buffer, xterm. This works for terminfo-based systems, 842 updating the titeInhibit resource. 843 Ps = 1 0 4 7 -> Use Alternate Screen Buffer, xterm. This 844 may be disabled by the titeInhibit resource. 845 Ps = 1 0 4 8 -> Save cursor as in DECSC, xterm. This may 846 be disabled by the titeInhibit resource. 847 Ps = 1 0 4 9 -> Save cursor as in DECSC, xterm. After 848 saving the cursor, switch to the Alternate Screen Buffer, 849 clearing it first. This may be disabled by the titeInhibit 850 resource. This control combines the effects of the 1 0 4 7 851 and 1 0 4 8 modes. Use this with terminfo-based applications 852 rather than the 4 7 mode. 853 Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode, 854 xterm. 855 Ps = 1 0 5 1 -> Set Sun function-key mode, xterm. 856 Ps = 1 0 5 2 -> Set HP function-key mode, xterm. 857 Ps = 1 0 5 3 -> Set SCO function-key mode, xterm. 858 Ps = 1 0 6 0 -> Set legacy keyboard emulation, i.e, X11R6, 859 xterm. 860 Ps = 1 0 6 1 -> Set VT220 keyboard emulation, xterm. 861 Ps = 2 0 0 4 -> Set bracketed paste mode, xterm. 862 863CSI Ps i Media Copy (MC). 864 Ps = 0 -> Print screen (default). 865 Ps = 4 -> Turn off printer controller mode. 866 Ps = 5 -> Turn on printer controller mode. 867 Ps = 1 0 -> HTML screen dump, xterm. 868 Ps = 1 1 -> SVG screen dump, xterm. 869 870CSI ? Ps i 871 Media Copy (MC), DEC-specific. 872 Ps = 1 -> Print line containing cursor. 873 Ps = 4 -> Turn off autoprint mode. 874 Ps = 5 -> Turn on autoprint mode. 875 Ps = 1 0 -> Print composed display, ignores DECPEX. 876 Ps = 1 1 -> Print all pages. 877 878CSI Pm l Reset Mode (RM). 879 Ps = 2 -> Keyboard Action Mode (KAM). 880 Ps = 4 -> Replace Mode (IRM). 881 Ps = 1 2 -> Send/receive (SRM). 882 Ps = 2 0 -> Normal Linefeed (LNM). 883 884CSI ? Pm l 885 DEC Private Mode Reset (DECRST). 886 Ps = 1 -> Normal Cursor Keys (DECCKM), VT100. 887 Ps = 2 -> Designate VT52 mode (DECANM), VT100. 888 Ps = 3 -> 80 Column Mode (DECCOLM), VT100. 889 Ps = 4 -> Jump (Fast) Scroll (DECSCLM), VT100. 890 Ps = 5 -> Normal Video (DECSCNM), VT100. 891 Ps = 6 -> Normal Cursor Mode (DECOM), VT100. 892 Ps = 7 -> No Auto-Wrap Mode (DECAWM), VT100. 893 Ps = 8 -> No Auto-Repeat Keys (DECARM), VT100. 894 Ps = 9 -> Don't send Mouse X & Y on button press, xterm. 895 Ps = 1 0 -> Hide toolbar (rxvt). 896 Ps = 1 2 -> Stop blinking cursor (AT&T 610). 897 Ps = 1 3 -> Disable blinking cursor (reset only via 898 resource or menu). 899 Ps = 1 4 -> Disable XOR of blinking cursor control sequence 900 and menu. 901 Ps = 1 8 -> Don't Print Form Feed (DECPFF), VT220. 902 Ps = 1 9 -> Limit print to scrolling region (DECPEX), 903 VT220. 904 Ps = 2 5 -> Hide cursor (DECTCEM), VT220. 905 Ps = 3 0 -> Don't show scrollbar (rxvt). 906 Ps = 3 5 -> Disable font-shifting functions (rxvt). 907 Ps = 4 0 -> Disallow 80 -> 132 mode, xterm. 908 Ps = 4 1 -> No more(1) fix (see curses resource). 909 Ps = 4 2 -> Disable National Replacement Character sets 910 (DECNRCM), VT220. 911 Ps = 4 3 -> Disable Graphics Expanded Print Mode (DECGEPM). 912 Ps = 4 4 -> Turn off margin bell, xterm. 913 Ps = 4 4 -> Disable Graphics Print Color Mode (DECGPCM). 914 Ps = 4 5 -> No Reverse-wraparound mode, xterm. 915 Ps = 4 5 -> Disable Graphics Print ColorSpace (DECGPCS). 916 Ps = 4 6 -> Stop logging, xterm. This is normally disabled 917 by a compile-time option. 918 Ps = 4 7 -> Use Normal Screen Buffer, xterm. 919 Ps = 4 7 -> Disable Graphics Rotated Print Mode (DECGRPM). 920 Ps = 6 6 -> Numeric keypad mode (DECNKM), VT320. 921 Ps = 6 7 -> Backarrow key sends delete (DECBKM), VT340, 922 VT420. This sets the backarrowKey resource to "false". 923 Ps = 6 9 -> Disable left and right margin mode (DECLRMM), 924 VT420 and up. 925 Ps = 8 0 -> Enable Sixel Scrolling (DECSDM). 926 Ps = 9 5 -> Clear screen when DECCOLM is set/reset 927 (DECNCSM), VT510 and up. 928 Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and 929 release. See the section Mouse Tracking. 930 Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking, xterm. 931 Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking, 932 xterm. See the section Button-event tracking. 933 Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking, xterm. 934 See the section Any-event tracking. 935 Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events, xterm. 936 Ps = 1 0 0 5 -> Disable UTF-8 Mouse Mode, xterm. 937 Ps = 1 0 0 6 -> Disable SGR Mouse Mode, xterm. 938 Ps = 1 0 0 7 -> Disable Alternate Scroll Mode, xterm. This 939 corresponds to the alternateScroll resource. 940 Ps = 1 0 1 0 -> Don't scroll to bottom on tty output 941 (rxvt). This sets the scrollTtyOutput resource to "false". 942 Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt). 943 This sets the scrollKey resource to "false". 944 Ps = 1 0 1 5 -> Disable urxvt Mouse Mode. 945 Ps = 1 0 1 6 -> Disable SGR Mouse Pixel-Mode, xterm. 946 Ps = 1 0 3 4 -> Don't interpret "meta" key, xterm. This 947 disables the eightBitInput resource. 948 Ps = 1 0 3 5 -> Disable special modifiers for Alt and 949 NumLock keys, xterm. This disables the numLock resource. 950 Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key, 951 xterm. This disables the metaSendsEscape resource. 952 Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad 953 Delete key, xterm. 954 Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key, 955 xterm. This disables the altSendsEscape resource. 956 Ps = 1 0 4 0 -> Do not keep selection when not highlighted, 957 xterm. This disables the keepSelection resource. 958 Ps = 1 0 4 1 -> Use the PRIMARY selection, xterm. This 959 disables the selectToClipboard resource. 960 Ps = 1 0 4 2 -> Disable Urgency window manager hint when 961 Control-G is received, xterm. This disables the bellIsUrgent 962 resource. 963 Ps = 1 0 4 3 -> Disable raising of the window when Control- 964 G is received, xterm. This disables the popOnBell resource. 965 Ps = 1 0 4 6 -> Disable switching to/from Alternate Screen 966 Buffer, xterm. This works for terminfo-based systems, 967 updating the titeInhibit resource. If currently using the 968 Alternate Screen Buffer, xterm switches to the Normal Screen 969 Buffer. 970 Ps = 1 0 4 7 -> Use Normal Screen Buffer, xterm. Clear the 971 screen first if in the Alternate Screen Buffer. This may be 972 disabled by the titeInhibit resource. 973 Ps = 1 0 4 8 -> Restore cursor as in DECRC, xterm. This 974 may be disabled by the titeInhibit resource. 975 Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor 976 as in DECRC, xterm. This may be disabled by the titeInhibit 977 resource. This combines the effects of the 1 0 4 7 and 1 0 4 978 8 modes. Use this with terminfo-based applications rather 979 than the 4 7 mode. 980 Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode, 981 xterm. 982 Ps = 1 0 5 1 -> Reset Sun function-key mode, xterm. 983 Ps = 1 0 5 2 -> Reset HP function-key mode, xterm. 984 Ps = 1 0 5 3 -> Reset SCO function-key mode, xterm. 985 Ps = 1 0 6 0 -> Reset legacy keyboard emulation, i.e, 986 X11R6, xterm. 987 Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style, 988 xterm. 989 Ps = 2 0 0 4 -> Reset bracketed paste mode, xterm. 990 991CSI Pm m Character Attributes (SGR). 992 Ps = 0 -> Normal (default), VT100. 993 Ps = 1 -> Bold, VT100. 994 Ps = 2 -> Faint, decreased intensity, ECMA-48 2nd. 995 Ps = 3 -> Italicized, ECMA-48 2nd. 996 Ps = 4 -> Underlined, VT100. 997 Ps = 5 -> Blink, VT100. 998 This appears as Bold in X11R6 xterm. 999 Ps = 7 -> Inverse, VT100. 1000 Ps = 8 -> Invisible, i.e., hidden, ECMA-48 2nd, VT300. 1001 Ps = 9 -> Crossed-out characters, ECMA-48 3rd. 1002 Ps = 2 1 -> Doubly-underlined, ECMA-48 3rd. 1003 Ps = 2 2 -> Normal (neither bold nor faint), ECMA-48 3rd. 1004 Ps = 2 3 -> Not italicized, ECMA-48 3rd. 1005 Ps = 2 4 -> Not underlined, ECMA-48 3rd. 1006 Ps = 2 5 -> Steady (not blinking), ECMA-48 3rd. 1007 Ps = 2 7 -> Positive (not inverse), ECMA-48 3rd. 1008 Ps = 2 8 -> Visible, i.e., not hidden, ECMA-48 3rd, VT300. 1009 Ps = 2 9 -> Not crossed-out, ECMA-48 3rd. 1010 Ps = 3 0 -> Set foreground color to Black. 1011 Ps = 3 1 -> Set foreground color to Red. 1012 Ps = 3 2 -> Set foreground color to Green. 1013 Ps = 3 3 -> Set foreground color to Yellow. 1014 Ps = 3 4 -> Set foreground color to Blue. 1015 Ps = 3 5 -> Set foreground color to Magenta. 1016 Ps = 3 6 -> Set foreground color to Cyan. 1017 Ps = 3 7 -> Set foreground color to White. 1018 Ps = 3 9 -> Set foreground color to default, ECMA-48 3rd. 1019 Ps = 4 0 -> Set background color to Black. 1020 Ps = 4 1 -> Set background color to Red. 1021 Ps = 4 2 -> Set background color to Green. 1022 Ps = 4 3 -> Set background color to Yellow. 1023 Ps = 4 4 -> Set background color to Blue. 1024 Ps = 4 5 -> Set background color to Magenta. 1025 Ps = 4 6 -> Set background color to Cyan. 1026 Ps = 4 7 -> Set background color to White. 1027 Ps = 4 9 -> Set background color to default, ECMA-48 3rd. 1028 1029 Some of the above note the edition of ECMA-48 which first 1030 describes a feature. In its successive editions from 1979 to 1031 1991 (2nd 1979, 3rd 1984, 4th 1986, and 5th 1991), ECMA-48 1032 listed codes through 6 5 (skipping several toward the end of 1033 the range). Most of the ECMA-48 codes not implemented in 1034 xterm were never implemented in a hardware terminal. Several 1035 (such as 3 9 and 4 9 ) are either noted in ECMA-48 as 1036 implementation defined, or described in vague terms. 1037 1038 The successive editions of ECMA-48 give little attention to 1039 changes from one edition to the next, except to comment on 1040 features which have become obsolete. ECMA-48 1st (1976) is 1041 unavailable; there is no reliable source of information which 1042 states whether "ANSI" color was defined in that edition, or 1043 later (1979). The VT100 (1978) implemented the most commonly 1044 used non-color video attributes which are given in the 2nd 1045 edition. 1046 1047 While 8-color support is described in ECMA-48 2nd edition, the 1048 VT500 series (introduced in 1993) were the first DEC terminals 1049 implementing "ANSI" color. The DEC terminal's use of color is 1050 known to differ from xterm; useful documentation on this 1051 series became available too late to influence xterm. 1052 1053 If 16-color support is compiled, the following aixterm 1054 controls apply. Assume that xterm's resources are set so that 1055 the ISO color codes are the first 8 of a set of 16. Then the 1056 aixterm colors are the bright versions of the ISO colors: 1057 1058 Ps = 9 0 -> Set foreground color to Black. 1059 Ps = 9 1 -> Set foreground color to Red. 1060 Ps = 9 2 -> Set foreground color to Green. 1061 Ps = 9 3 -> Set foreground color to Yellow. 1062 Ps = 9 4 -> Set foreground color to Blue. 1063 Ps = 9 5 -> Set foreground color to Magenta. 1064 Ps = 9 6 -> Set foreground color to Cyan. 1065 Ps = 9 7 -> Set foreground color to White. 1066 Ps = 1 0 0 -> Set background color to Black. 1067 Ps = 1 0 1 -> Set background color to Red. 1068 Ps = 1 0 2 -> Set background color to Green. 1069 Ps = 1 0 3 -> Set background color to Yellow. 1070 Ps = 1 0 4 -> Set background color to Blue. 1071 Ps = 1 0 5 -> Set background color to Magenta. 1072 Ps = 1 0 6 -> Set background color to Cyan. 1073 Ps = 1 0 7 -> Set background color to White. 1074 1075 If xterm is compiled with the 16-color support disabled, it 1076 supports the following, from rxvt: 1077 Ps = 1 0 0 -> Set foreground and background color to 1078 default. 1079 1080 XTerm maintains a color palette whose entries are identified 1081 by an index beginning with zero. If 88- or 256-color support 1082 is compiled, the following apply: 1083 o All parameters are decimal integers. 1084 o RGB values range from zero (0) to 255. 1085 o The 88- and 256-color support uses subparameters described 1086 in ISO-8613-6 for indexed color. ISO-8613-6 also mentions 1087 direct color, using a similar scheme. xterm supports 1088 that, too. 1089 o xterm allows either colons (standard) or semicolons 1090 (legacy) to separate the subparameters (but after the 1091 first colon, colons must be used). 1092 1093 The indexed- and direct-color features are summarized in the 1094 FAQ, which explains why semicolon is accepted as a 1095 subparameter delimiter: 1096 1097 Can I set a color by its number? 1098 1099 1100 These ISO-8613-6 controls (marked in ECMA-48 5th edition as 1101 "reserved for future standardization") are supported by xterm: 1102 Ps = 3 8 : 2 : Pi : Pr : Pg : Pb -> Set foreground color 1103 using RGB values. If xterm is not compiled with direct-color 1104 support, it uses the closest match in its palette for the 1105 given RGB Pr/Pg/Pb. The color space identifier Pi is ignored. 1106 Ps = 3 8 : 5 : Ps -> Set foreground color to Ps, using 1107 indexed color. 1108 Ps = 4 8 : 2 : Pi : Pr : Pg : Pb -> Set background color 1109 using RGB values. If xterm is not compiled with direct-color 1110 support, it uses the closest match in its palette for the 1111 given RGB Pr/Pg/Pb. The color space identifier Pi is ignored. 1112 Ps = 4 8 : 5 : Ps -> Set background color to Ps, using 1113 indexed color. 1114 1115 This variation on ISO-8613-6 is supported for compatibility 1116 with KDE konsole: 1117 Ps = 3 8 ; 2 ; Pr ; Pg ; Pb -> Set foreground color using 1118 RGB values. If xterm is not compiled with direct-color 1119 support, it uses the closest match in its palette for the 1120 given RGB Pr/Pg/Pb. 1121 Ps = 4 8 ; 2 ; Pr ; Pg ; Pb -> Set background color using 1122 RGB values. If xterm is not compiled with direct-color 1123 support, it uses the closest match in its palette for the 1124 given RGB Pr/Pg/Pb. 1125 1126 In each case, if xterm is compiled with direct-color support, 1127 and the resource directColor is true, then rather than 1128 choosing the closest match, xterm asks the X server to 1129 directly render a given color. 1130 1131CSI > Pp ; Pv m 1132CSI > Pp m 1133 Set/reset key modifier options (XTMODKEYS), xterm. Set or 1134 reset resource-values used by xterm to decide whether to 1135 construct escape sequences holding information about the 1136 modifiers pressed with a given key. 1137 1138 The first parameter Pp identifies the resource to set/reset. 1139 The second parameter Pv is the value to assign to the 1140 resource. 1141 1142 If the second parameter is omitted, the resource is reset to 1143 its initial value. Values 3 and 5 are reserved for keypad- 1144 keys and string-keys. 1145 1146 Pp = 0 -> modifyKeyboard. 1147 Pp = 1 -> modifyCursorKeys. 1148 Pp = 2 -> modifyFunctionKeys. 1149 Pp = 4 -> modifyOtherKeys. 1150 1151 If no parameters are given, all resources are reset to their 1152 initial values. 1153 1154CSI Ps n Device Status Report (DSR). 1155 Ps = 5 -> Status Report. 1156 Result ("OK") is CSI 0 n 1157 Ps = 6 -> Report Cursor Position (CPR) [row;column]. 1158 Result is CSI r ; c R 1159 1160 Note: it is possible for this sequence to be sent by a 1161 function key. For example, with the default keyboard 1162 configuration the shifted F1 key may send (with shift-, 1163 control-, alt-modifiers) 1164 1165 CSI 1 ; 2 R , or 1166 CSI 1 ; 5 R , or 1167 CSI 1 ; 6 R , etc. 1168 1169 The second parameter encodes the modifiers; values range from 1170 2 to 16. See the section PC-Style Function Keys for the 1171 codes. The modifyFunctionKeys and modifyKeyboard resources 1172 can change the form of the string sent from the modified F1 1173 key. 1174 1175CSI > Ps n 1176 Disable key modifier options, xterm. These modifiers may be 1177 enabled via the CSI > Pm m sequence. This control sequence 1178 corresponds to a resource value of "-1", which cannot be set 1179 with the other sequence. 1180 1181 The parameter identifies the resource to be disabled: 1182 1183 Ps = 0 -> modifyKeyboard. 1184 Ps = 1 -> modifyCursorKeys. 1185 Ps = 2 -> modifyFunctionKeys. 1186 Ps = 4 -> modifyOtherKeys. 1187 1188 If the parameter is omitted, modifyFunctionKeys is disabled. 1189 When modifyFunctionKeys is disabled, xterm uses the modifier 1190 keys to make an extended sequence of function keys rather than 1191 adding a parameter to each function key to denote the 1192 modifiers. 1193 1194CSI ? Ps n 1195 Device Status Report (DSR, DEC-specific). 1196 Ps = 6 -> Report Cursor Position (DECXCPR). The response 1197 [row;column] is returned as 1198 CSI ? r ; c R 1199 (assumes the default page, i.e., "1"). 1200 Ps = 1 5 -> Report Printer status. The response is 1201 CSI ? 1 0 n (ready). or 1202 CSI ? 1 1 n (not ready). 1203 Ps = 2 5 -> Report UDK status. The response is 1204 CSI ? 2 0 n (unlocked) 1205 or 1206 CSI ? 2 1 n (locked). 1207 Ps = 2 6 -> Report Keyboard status. The response is 1208 CSI ? 2 7 ; 1 ; 0 ; 0 n (North American). 1209 1210 The last two parameters apply to VT300 & up (keyboard ready) 1211 and VT400 & up (LK01) respectively. 1212 1213 Ps = 5 3 -> Report Locator status. The response is CSI ? 5 1214 3 n Locator available, if compiled-in, or CSI ? 5 0 n No 1215 Locator, if not. 1216 Ps = 5 5 -> Report Locator status. The response is CSI ? 5 1217 3 n Locator available, if compiled-in, or CSI ? 5 0 n No 1218 Locator, if not. 1219 Ps = 5 6 -> Report Locator type. The response is CSI ? 5 7 1220 ; 1 n Mouse, if compiled-in, or CSI ? 5 7 ; 0 n Cannot 1221 identify, if not. 1222 Ps = 6 2 -> Report macro space (DECMSR). The response is 1223 CSI Pn * { . 1224 Ps = 6 3 -> Report memory checksum (DECCKSR), VT420 and up. 1225 The response is DCS Pt ! ~ x x x x ST . 1226 Pt is the request id (from an optional parameter to the 1227 request). 1228 The x's are hexadecimal digits 0-9 and A-F. 1229 Ps = 7 5 -> Report data integrity. The response is CSI ? 7 1230 0 n (ready, no errors). 1231 Ps = 8 5 -> Report multi-session configuration. The 1232 response is CSI ? 8 3 n (not configured for multiple-session 1233 operation). 1234 1235CSI > Ps p 1236 Set resource value pointerMode (XTSMPOINTER), xterm. This is 1237 used by xterm to decide whether to hide the pointer cursor as 1238 the user types. 1239 1240 Valid values for the parameter: 1241 Ps = 0 -> never hide the pointer. 1242 Ps = 1 -> hide if the mouse tracking mode is not enabled. 1243 Ps = 2 -> always hide the pointer, except when leaving the 1244 window. 1245 Ps = 3 -> always hide the pointer, even if leaving/entering 1246 the window. 1247 1248 If no parameter is given, xterm uses the default, which is 1 . 1249 1250CSI ! p Soft terminal reset (DECSTR), VT220 and up. 1251 1252CSI Pl ; Pc " p 1253 Set conformance level (DECSCL), VT220 and up. 1254 1255 The first parameter selects the conformance level. Valid 1256 values are: 1257 Pl = 6 1 -> level 1, e.g., VT100. 1258 Pl = 6 2 -> level 2, e.g., VT200. 1259 Pl = 6 3 -> level 3, e.g., VT300. 1260 Pl = 6 4 -> level 4, e.g., VT400. 1261 Pl = 6 5 -> level 5, e.g., VT500. 1262 1263 The second parameter selects the C1 control transmission mode. 1264 This is an optional parameter, ignored in conformance level 1. 1265 Valid values are: 1266 Pc = 0 -> 8-bit controls. 1267 Pc = 1 -> 7-bit controls (DEC factory default). 1268 Pc = 2 -> 8-bit controls. 1269 1270 The 7-bit and 8-bit control modes can also be set by S7C1T and 1271 S8C1T, but DECSCL is preferred. 1272 1273CSI Ps $ p 1274 Request ANSI mode (DECRQM). For VT300 and up, reply DECRPM is 1275 CSI Ps; Pm $ y 1276 where Ps is the mode number as in SM/RM, and Pm is the mode 1277 value: 1278 0 - not recognized 1279 1 - set 1280 2 - reset 1281 3 - permanently set 1282 4 - permanently reset 1283 1284CSI ? Ps $ p 1285 Request DEC private mode (DECRQM). For VT300 and up, reply 1286 DECRPM is 1287 CSI ? Ps; Pm $ y 1288 where Ps is the mode number as in DECSET/DECSET, Pm is the 1289 mode value as in the ANSI DECRQM. 1290 Two private modes are read-only (i.e., 1 3 and 1 4 ), 1291 provided only for reporting their values using this control 1292 sequence. They correspond to the resources cursorBlink and 1293 cursorBlinkXOR. 1294CSI # p 1295CSI Pm # p 1296 Push video attributes onto stack (XTPUSHSGR), xterm. This is 1297 an alias for CSI # { , used to work around language 1298 limitations of C#. 1299 1300CSI > Ps q 1301 Ps = 0 -> Report xterm name and version (XTVERSION). The 1302 response is a DSR sequence identifying the version: DCS > | 1303 text ST 1304 1305CSI Ps q Load LEDs (DECLL), VT100. 1306 Ps = 0 -> Clear all LEDS (default). 1307 Ps = 1 -> Light Num Lock. 1308 Ps = 2 -> Light Caps Lock. 1309 Ps = 3 -> Light Scroll Lock. 1310 Ps = 2 1 -> Extinguish Num Lock. 1311 Ps = 2 2 -> Extinguish Caps Lock. 1312 Ps = 2 3 -> Extinguish Scroll Lock. 1313 1314CSI Ps SP q 1315 Set cursor style (DECSCUSR), VT520. 1316 Ps = 0 -> blinking block. 1317 Ps = 1 -> blinking block (default). 1318 Ps = 2 -> steady block. 1319 Ps = 3 -> blinking underline. 1320 Ps = 4 -> steady underline. 1321 Ps = 5 -> blinking bar, xterm. 1322 Ps = 6 -> steady bar, xterm. 1323 1324CSI Ps " q 1325 Select character protection attribute (DECSCA), VT220. Valid 1326 values for the parameter: 1327 Ps = 0 -> DECSED and DECSEL can erase (default). 1328 Ps = 1 -> DECSED and DECSEL cannot erase. 1329 Ps = 2 -> DECSED and DECSEL can erase. 1330 1331CSI # q Pop video attributes from stack (XTPOPSGR), xterm. This is an 1332 alias for CSI # } , used to work around language limitations 1333 of C#. 1334 1335CSI Ps ; Ps r 1336 Set Scrolling Region [top;bottom] (default = full size of 1337 window) (DECSTBM), VT100. 1338 1339CSI ? Pm r 1340 Restore DEC Private Mode Values (XTRESTORE), xterm. The value 1341 of Ps previously saved is restored. Ps values are the same as 1342 for DECSET. 1343 1344 Like Restore Cursor (DECRC), this uses a one-level cache. 1345 Unlike Restore Cursor, specific settings can be saved and 1346 restored independently. Only those modes listed as parameters 1347 are restored. 1348 1349CSI Pt ; Pl ; Pb ; Pr ; Pm $ r 1350 Change Attributes in Rectangular Area (DECCARA), VT400 and up. 1351 Pt ; Pl ; Pb ; Pr denotes the rectangle. 1352 Pm denotes the SGR attributes to change: 0, 1, 4, 5, 7. 1353 1354CSI s Save cursor, available only when DECLRMM is disabled (SCOSC, 1355 also ANSI.SYS). 1356 1357CSI Pl ; Pr s 1358 Set left and right margins (DECSLRM), VT420 and up. This is 1359 available only when DECLRMM is enabled. 1360 1361CSI > Ps s 1362 Set/reset shift-escape options (XTSHIFTESCAPE), xterm. This 1363 corresponds to the shiftEscape resource. 1364 1365 Valid values for the parameter: 1366 Ps = 0 -> allow shift-key to override mouse protocol. 1367 Ps = 1 -> conditionally allow shift-key as modifier in 1368 mouse protocol. 1369 1370 These resource values are disallowed in the control sequence: 1371 Ps = 2 -> always allow shift-key as modifier in mouse 1372 protocol. 1373 Ps = 3 -> never allow shift-key as modifier in mouse 1374 protocol. 1375 1376 If no parameter is given, xterm uses the default, which is 0 . 1377 1378CSI ? Pm s 1379 Save DEC Private Mode Values (XTSAVE), xterm. Ps values are 1380 the same as for DECSET. 1381 1382 Like Save Cursor (DECSC), this uses a one-level cache. Unlike 1383 Save Cursor, specific settings can be saved and restored 1384 independently. Only those modes listed as parameters are 1385 saved. 1386 1387CSI Ps ; Ps ; Ps t 1388 Window manipulation (XTWINOPS), dtterm, extended by xterm. 1389 These controls may be disabled using the allowWindowOps 1390 resource. 1391 1392 xterm uses Extended Window Manager Hints (EWMH) to maximize 1393 the window. Some window managers have incomplete support for 1394 EWMH. For instance, fvwm, flwm and quartz-wm advertise 1395 support for maximizing windows horizontally or vertically, but 1396 in fact equate those to the maximize operation. 1397 1398 Valid values for the first (and any additional parameters) 1399 are: 1400 Ps = 1 -> De-iconify window. 1401 Ps = 2 -> Iconify window. 1402 Ps = 3 ; x ; y -> Move window to [x, y]. 1403 Ps = 4 ; height ; width -> Resize the xterm window to 1404 given height and width in pixels. Omitted parameters reuse 1405 the current height or width. Zero parameters use the 1406 display's height or width. 1407 Ps = 5 -> Raise the xterm window to the front of the 1408 stacking order. 1409 Ps = 6 -> Lower the xterm window to the bottom of the 1410 stacking order. 1411 Ps = 7 -> Refresh the xterm window. 1412 Ps = 8 ; height ; width -> Resize the text area to given 1413 height and width in characters. Omitted parameters reuse the 1414 current height or width. Zero parameters use the display's 1415 height or width. 1416 Ps = 9 ; 0 -> Restore maximized window. 1417 Ps = 9 ; 1 -> Maximize window (i.e., resize to screen 1418 size). 1419 Ps = 9 ; 2 -> Maximize window vertically. 1420 Ps = 9 ; 3 -> Maximize window horizontally. 1421 Ps = 1 0 ; 0 -> Undo full-screen mode. 1422 Ps = 1 0 ; 1 -> Change to full-screen. 1423 Ps = 1 0 ; 2 -> Toggle full-screen. 1424 Ps = 1 1 -> Report xterm window state. 1425 If the xterm window is non-iconified, it returns CSI 1 t . 1426 If the xterm window is iconified, it returns CSI 2 t . 1427 Ps = 1 3 -> Report xterm window position. 1428 Note: X Toolkit positions can be negative, but the reported 1429 values are unsigned, in the range 0-65535. Negative values 1430 correspond to 32768-65535. 1431 Result is CSI 3 ; x ; y t 1432 Ps = 1 3 ; 2 -> Report xterm text-area position. 1433 Result is CSI 3 ; x ; y t 1434 Ps = 1 4 -> Report xterm text area size in pixels. 1435 Result is CSI 4 ; height ; width t 1436 Ps = 1 4 ; 2 -> Report xterm window size in pixels. 1437 Normally xterm's window is larger than its text area, since it 1438 includes the frame (or decoration) applied by the window 1439 manager, as well as the area used by a scroll-bar. 1440 Result is CSI 4 ; height ; width t 1441 Ps = 1 5 -> Report size of the screen in pixels. 1442 Result is CSI 5 ; height ; width t 1443 Ps = 1 6 -> Report xterm character cell size in pixels. 1444 Result is CSI 6 ; height ; width t 1445 Ps = 1 8 -> Report the size of the text area in characters. 1446 Result is CSI 8 ; height ; width t 1447 Ps = 1 9 -> Report the size of the screen in characters. 1448 Result is CSI 9 ; height ; width t 1449 Ps = 2 0 -> Report xterm window's icon label. 1450 Result is OSC L label ST 1451 Ps = 2 1 -> Report xterm window's title. 1452 Result is OSC l label ST 1453 Ps = 2 2 ; 0 -> Save xterm icon and window title on stack. 1454 Ps = 2 2 ; 1 -> Save xterm icon title on stack. 1455 Ps = 2 2 ; 2 -> Save xterm window title on stack. 1456 Ps = 2 3 ; 0 -> Restore xterm icon and window title from 1457 stack. 1458 Ps = 2 3 ; 1 -> Restore xterm icon title from stack. 1459 Ps = 2 3 ; 2 -> Restore xterm window title from stack. 1460 Ps >= 2 4 -> Resize to Ps lines (DECSLPP), VT340 and VT420. 1461 xterm adapts this by resizing its window. 1462 1463CSI > Pm t 1464 This xterm control sets one or more features of the title 1465 modes (XTSMTITLE), xterm. Each parameter enables a single 1466 feature. 1467 Ps = 0 -> Set window/icon labels using hexadecimal. 1468 Ps = 1 -> Query window/icon labels using hexadecimal. 1469 Ps = 2 -> Set window/icon labels using UTF-8. 1470 Ps = 3 -> Query window/icon labels using UTF-8. (See 1471 discussion of Title Modes) 1472 1473CSI Ps SP t 1474 Set warning-bell volume (DECSWBV), VT520. 1475 Ps = 0 or 1 -> off. 1476 Ps = 2 , 3 or 4 -> low. 1477 Ps = 5 , 6 , 7 , or 8 -> high. 1478 1479CSI Pt ; Pl ; Pb ; Pr ; Pm $ t 1480 Reverse Attributes in Rectangular Area (DECRARA), VT400 and 1481 up. 1482 Pt ; Pl ; Pb ; Pr denotes the rectangle. 1483 Pm denotes the attributes to reverse, i.e., 1, 4, 5, 7. 1484 1485CSI u Restore cursor (SCORC, also ANSI.SYS). 1486 1487CSI Ps SP u 1488 Set margin-bell volume (DECSMBV), VT520. 1489 Ps = 0 , 5 , 6 , 7 , or 8 -> high. 1490 Ps = 1 -> off. 1491 Ps = 2 , 3 or 4 -> low. 1492 1493CSI Pt ; Pl ; Pb ; Pr ; Pp ; Pt ; Pl ; Pp $ v 1494 Copy Rectangular Area (DECCRA), VT400 and up. 1495 Pt ; Pl ; Pb ; Pr denotes the rectangle. 1496 Pp denotes the source page. 1497 Pt ; Pl denotes the target location. 1498 Pp denotes the target page. 1499 1500CSI Ps $ w 1501 Request presentation state report (DECRQPSR), VT320 and up. 1502 Ps = 0 -> error. 1503 Ps = 1 -> cursor information report (DECCIR). 1504 Response is 1505 DCS 1 $ u Pt ST 1506 Refer to the VT420 programming manual, which requires six 1507 pages to document the data string Pt, 1508 Ps = 2 -> tab stop report (DECTABSR). 1509 Response is 1510 DCS 2 $ u Pt ST 1511 The data string Pt is a list of the tab-stops, separated by 1512 "/" characters. 1513 1514CSI Pt ; Pl ; Pb ; Pr ' w 1515 Enable Filter Rectangle (DECEFR), VT420 and up. 1516 Parameters are [top;left;bottom;right]. 1517 Defines the coordinates of a filter rectangle and activates 1518 it. Anytime the locator is detected outside of the filter 1519 rectangle, an outside rectangle event is generated and the 1520 rectangle is disabled. Filter rectangles are always treated 1521 as "one-shot" events. Any parameters that are omitted default 1522 to the current locator position. If all parameters are 1523 omitted, any locator motion will be reported. DECELR always 1524 cancels any previous rectangle definition. 1525 1526CSI Ps x Request Terminal Parameters (DECREQTPARM). 1527 if Ps is a "0" (default) or "1", and xterm is emulating VT100, 1528 the control sequence elicits a response of the same form whose 1529 parameters describe the terminal: 1530 Ps -> the given Ps incremented by 2. 1531 Pn = 1 <- no parity. 1532 Pn = 1 <- eight bits. 1533 Pn = 1 <- 2 8 transmit 38.4k baud. 1534 Pn = 1 <- 2 8 receive 38.4k baud. 1535 Pn = 1 <- clock multiplier. 1536 Pn = 0 <- STP flags. 1537 1538CSI Ps * x 1539 Select Attribute Change Extent (DECSACE), VT420 and up. 1540 Ps = 0 -> from start to end position, wrapped. 1541 Ps = 1 -> from start to end position, wrapped. 1542 Ps = 2 -> rectangle (exact). 1543 1544CSI Pc ; Pt ; Pl ; Pb ; Pr $ x 1545 Fill Rectangular Area (DECFRA), VT420 and up. 1546 Pc is the character to use. 1547 Pt ; Pl ; Pb ; Pr denotes the rectangle. 1548 1549CSI Ps # y 1550 Select checksum extension (XTCHECKSUM), xterm. The bits of Ps 1551 modify the calculation of the checksum returned by DECRQCRA: 1552 0 -> do not negate the result. 1553 1 -> do not report the VT100 video attributes. 1554 2 -> do not omit checksum for blanks. 1555 3 -> omit checksum for cells not explicitly initialized. 1556 4 -> do not mask cell value to 8 bits or ignore combining 1557 characters. 1558 5 -> do not mask cell value to 7 bits. 1559 1560CSI Pi ; Pg ; Pt ; Pl ; Pb ; Pr * y 1561 Request Checksum of Rectangular Area (DECRQCRA), VT420 and up. 1562 Response is 1563 DCS Pi ! ~ x x x x ST 1564 Pi is the request id. 1565 Pg is the page number. 1566 Pt ; Pl ; Pb ; Pr denotes the rectangle. 1567 The x's are hexadecimal digits 0-9 and A-F. 1568 1569CSI Ps ; Pu ' z 1570 Enable Locator Reporting (DECELR). 1571 Valid values for the first parameter: 1572 Ps = 0 -> Locator disabled (default). 1573 Ps = 1 -> Locator enabled. 1574 Ps = 2 -> Locator enabled for one report, then disabled. 1575 The second parameter specifies the coordinate unit for locator 1576 reports. 1577 Valid values for the second parameter: 1578 Pu = 0 or omitted -> default to character cells. 1579 Pu = 1 <- device physical pixels. 1580 Pu = 2 <- character cells. 1581 1582CSI Pt ; Pl ; Pb ; Pr $ z 1583 Erase Rectangular Area (DECERA), VT400 and up. 1584 Pt ; Pl ; Pb ; Pr denotes the rectangle. 1585 1586CSI Pm ' { 1587 Select Locator Events (DECSLE). 1588 Valid values for the first (and any additional parameters) 1589 are: 1590 Ps = 0 -> only respond to explicit host requests (DECRQLP). 1591 This is default. It also cancels any filter rectangle. 1592 Ps = 1 -> report button down transitions. 1593 Ps = 2 -> do not report button down transitions. 1594 Ps = 3 -> report button up transitions. 1595 Ps = 4 -> do not report button up transitions. 1596 1597CSI # { 1598CSI Pm # { 1599 Push video attributes onto stack (XTPUSHSGR), xterm. The 1600 optional parameters correspond to the SGR encoding for video 1601 attributes, except for colors (which do not have a unique SGR 1602 code): 1603 Ps = 1 -> Bold. 1604 Ps = 2 -> Faint. 1605 Ps = 3 -> Italicized. 1606 Ps = 4 -> Underlined. 1607 Ps = 5 -> Blink. 1608 Ps = 7 -> Inverse. 1609 Ps = 8 -> Invisible. 1610 Ps = 9 -> Crossed-out characters. 1611 Ps = 2 1 -> Doubly-underlined. 1612 Ps = 3 0 -> Foreground color. 1613 Ps = 3 1 -> Background color. 1614 1615 If no parameters are given, all of the video attributes are 1616 saved. The stack is limited to 10 levels. 1617 1618CSI Pt ; Pl ; Pb ; Pr $ { 1619 Selective Erase Rectangular Area (DECSERA), VT400 and up. 1620 Pt ; Pl ; Pb ; Pr denotes the rectangle. 1621 1622CSI Pt ; Pl ; Pb ; Pr # | 1623 Report selected graphic rendition (XTREPORTSGR), xterm. The 1624 response is an SGR sequence which contains the attributes 1625 which are common to all cells in a rectangle. 1626 Pt ; Pl ; Pb ; Pr denotes the rectangle. 1627 1628CSI Ps $ | 1629 Select columns per page (DECSCPP), VT340. 1630 Ps = 0 -> 80 columns, default if Ps omitted. 1631 Ps = 8 0 -> 80 columns. 1632 Ps = 1 3 2 -> 132 columns. 1633 1634CSI Ps ' | 1635 Request Locator Position (DECRQLP). 1636 Valid values for the parameter are: 1637 Ps = 0 , 1 or omitted -> transmit a single DECLRP locator 1638 report. 1639 1640 If Locator Reporting has been enabled by a DECELR, xterm will 1641 respond with a DECLRP Locator Report. This report is also 1642 generated on button up and down events if they have been 1643 enabled with a DECSLE, or when the locator is detected outside 1644 of a filter rectangle, if filter rectangles have been enabled 1645 with a DECEFR. 1646 1647 <- CSI Pe ; Pb ; Pr ; Pc ; Pp & w 1648 1649 Parameters are [event;button;row;column;page]. 1650 Valid values for the event: 1651 Pe = 0 <- locator unavailable - no other parameters sent. 1652 Pe = 1 <- request - xterm received a DECRQLP. 1653 Pe = 2 <- left button down. 1654 Pe = 3 <- left button up. 1655 Pe = 4 <- middle button down. 1656 Pe = 5 <- middle button up. 1657 Pe = 6 <- right button down. 1658 Pe = 7 <- right button up. 1659 Pe = 8 <- M4 button down. 1660 Pe = 9 <- M4 button up. 1661 Pe = 1 0 <- locator outside filter rectangle. 1662 The "button" parameter is a bitmask indicating which buttons 1663 are pressed: 1664 Pb = 0 <- no buttons down. 1665 Pb & 1 <- right button down. 1666 Pb & 2 <- middle button down. 1667 Pb & 4 <- left button down. 1668 Pb & 8 <- M4 button down. 1669 The "row" and "column" parameters are the coordinates of the 1670 locator position in the xterm window, encoded as ASCII 1671 decimal. 1672 The "page" parameter is not used by xterm. 1673 1674CSI Ps * | 1675 Select number of lines per screen (DECSNLS), VT420 and up. 1676 1677CSI # } Pop video attributes from stack (XTPOPSGR), xterm. Popping 1678 restores the video-attributes which were saved using XTPUSHSGR 1679 to their previous state. 1680 1681CSI Ps ' } 1682 Insert Ps Column(s) (default = 1) (DECIC), VT420 and up. 1683 1684CSI Ps $ } 1685 Select active status display (DECSASD), VT320 and up. 1686 Ps = 0 -> main (default) 1687 Ps = 1 -> status line 1688 1689CSI Ps ' ~ 1690 Delete Ps Column(s) (default = 1) (DECDC), VT420 and up. 1691 1692CSI Ps $ ~ 1693 Select status line type (DECSSDT), VT320 and up. 1694 Ps = 0 -> none 1695 Ps = 1 -> indicator (default) 1696 Ps = 2 -> host-writable. 1697 1698 1699Operating System Commands 1700 1701OSC Ps ; Pt BEL 1702 1703OSC Ps ; Pt ST 1704 Set Text Parameters. Some control sequences return 1705 information: 1706 o For colors and font, if Pt is a "?", the control sequence 1707 elicits a response which consists of the control sequence 1708 which would set the corresponding value. 1709 o The dtterm control sequences allow you to determine the 1710 icon name and window title. 1711 1712 XTerm accepts either BEL or ST for terminating OSC 1713 sequences, and when returning information, uses the same 1714 terminator used in a query. While the latter is preferred, 1715 the former is supported for legacy applications: 1716 o Although documented in the changes for X.V10R4 (December 1717 1986), BEL as a string terminator dates from X11R4 1718 (December 1989). 1719 o Since XFree86-3.1.2Ee (August 1996), xterm has accepted ST 1720 (the documented string terminator in ECMA-48). 1721 1722 Ps specifies the type of operation to perform: 1723 Ps = 0 -> Change Icon Name and Window Title to Pt. 1724 Ps = 1 -> Change Icon Name to Pt. 1725 Ps = 2 -> Change Window Title to Pt. 1726 Ps = 3 -> Set X property on top-level window. Pt should be 1727 in the form "prop=value", or just "prop" to delete the 1728 property. 1729 Ps = 4 ; c ; spec -> Change Color Number c to the color 1730 specified by spec. 1731 1732 The spec can be a name or RGB specification as per 1733 XParseColor. Any number of c/spec pairs may be given. The 1734 color numbers correspond to the ANSI colors 0-7, their bright 1735 versions 8-15, and if supported, the remainder of the 88-color 1736 or 256-color table. 1737 1738 If a "?" is given rather than a name or RGB specification, 1739 xterm replies with a control sequence of the same form which 1740 can be used to set the corresponding color. Because more than 1741 one pair of color number and specification can be given in one 1742 control sequence, xterm can make more than one reply. 1743 1744 Ps = 5 ; c ; spec -> Change Special Color Number c to the 1745 color specified by spec. 1746 1747 The spec parameter can be a name or RGB specification as per 1748 XParseColor. Any number of c/spec pairs may be given. The 1749 special colors can also be set by adding the maximum number of 1750 colors (e.g., 88 or 256) to these codes in an OSC 4 control: 1751 1752 Pc = 0 <- resource colorBD (BOLD). 1753 Pc = 1 <- resource colorUL (UNDERLINE). 1754 Pc = 2 <- resource colorBL (BLINK). 1755 Pc = 3 <- resource colorRV (REVERSE). 1756 Pc = 4 <- resource colorIT (ITALIC). 1757 1758 Ps = 6 ; c ; f -> Enable/disable Special Color Number c. 1759 The second parameter tells xterm to enable the corresponding 1760 color mode if nonzero, disable it if zero. OSC 6 is the same 1761 as OSC 1 0 6 . 1762 1763 If no parameters are given, this control has no effect. 1764 1765 The 10 colors (below) which may be set or queried using 1 0 1766 through 1 9 are denoted dynamic colors, since the 1767 corresponding control sequences were the first means for 1768 setting xterm's colors dynamically, i.e., after it was 1769 started. They are not the same as the ANSI colors (however, 1770 the dynamic text foreground and background colors are used 1771 when ANSI colors are reset using SGR 3 9 and 4 9 , 1772 respectively). These controls may be disabled using the 1773 allowColorOps resource. At least one parameter is expected 1774 for Pt. Each successive parameter changes the next color in 1775 the list. The value of Ps tells the starting point in the 1776 list. The colors are specified by name or RGB specification 1777 as per XParseColor. 1778 1779 If a "?" is given rather than a name or RGB specification, 1780 xterm replies with a control sequence of the same form which 1781 can be used to set the corresponding dynamic color. Because 1782 more than one pair of color number and specification can be 1783 given in one control sequence, xterm can make more than one 1784 reply. 1785 1786 Ps = 1 0 -> Change VT100 text foreground color to Pt. 1787 Ps = 1 1 -> Change VT100 text background color to Pt. 1788 Ps = 1 2 -> Change text cursor color to Pt. 1789 Ps = 1 3 -> Change pointer foreground color to Pt. 1790 Ps = 1 4 -> Change pointer background color to Pt. 1791 Ps = 1 5 -> Change Tektronix foreground color to Pt. 1792 Ps = 1 6 -> Change Tektronix background color to Pt. 1793 Ps = 1 7 -> Change highlight background color to Pt. 1794 Ps = 1 8 -> Change Tektronix cursor color to Pt. 1795 Ps = 1 9 -> Change highlight foreground color to Pt. 1796 1797 Ps = 2 2 -> Change pointer cursor to Pt. 1798 1799 Ps = 4 6 -> Change Log File to Pt. This is normally 1800 disabled by a compile-time option. 1801 1802 Ps = 5 0 -> Set Font to Pt. These controls may be disabled 1803 using the allowFontOps resource. If Pt begins with a "#", 1804 index in the font menu, relative (if the next character is a 1805 plus or minus sign) or absolute. A number is expected but not 1806 required after the sign (the default is the current entry for 1807 relative, zero for absolute indexing). 1808 1809 The same rule (plus or minus sign, optional number) is used 1810 when querying the font. The remainder of Pt is ignored. 1811 1812 A font can be specified after a "#" index expression, by 1813 adding a space and then the font specifier. 1814 1815 If the TrueType Fonts menu entry is set (the renderFont 1816 resource), then this control sets/queries the faceName 1817 resource. 1818 1819 Ps = 5 1 -> reserved for Emacs shell. 1820 1821 Ps = 5 2 -> Manipulate Selection Data. These controls may 1822 be disabled using the allowWindowOps resource. The parameter 1823 Pt is parsed as 1824 Pc ; Pd 1825 1826 The first, Pc, may contain zero or more characters from the 1827 set c , p , q , s , 0 , 1 , 2 , 3 , 4 , 5 , 6 , and 7 . It is 1828 used to construct a list of selection parameters for 1829 clipboard, primary, secondary, select, or cut-buffers 0 1830 through 7 respectively, in the order given. If the parameter 1831 is empty, xterm uses s 0 , to specify the configurable 1832 primary/clipboard selection and cut-buffer 0. 1833 1834 The second parameter, Pd, gives the selection data. Normally 1835 this is a string encoded in base64 (RFC-4648). The data 1836 becomes the new selection, which is then available for pasting 1837 by other applications. 1838 1839 If the second parameter is a ? , xterm replies to the host 1840 with the selection data encoded using the same protocol. It 1841 uses the first selection found by asking successively for each 1842 item from the list of selection parameters. 1843 1844 If the second parameter is neither a base64 string nor ? , 1845 then the selection is cleared. 1846 1847 Ps = 1 0 4 ; c -> Reset Color Number c. It is reset to the 1848 color specified by the corresponding X resource. Any number 1849 of c parameters may be given. These parameters correspond to 1850 the ANSI colors 0-7, their bright versions 8-15, and if 1851 supported, the remainder of the 88-color or 256-color table. 1852 If no parameters are given, the entire table will be reset. 1853 1854 Ps = 1 0 5 ; c -> Reset Special Color Number c. It is reset 1855 to the color specified by the corresponding X resource. Any 1856 number of c parameters may be given. These parameters 1857 correspond to the special colors which can be set using an OSC 1858 5 control (or by adding the maximum number of colors using an 1859 OSC 4 control). 1860 1861 If no parameters are given, all special colors will be reset. 1862 1863 Ps = 1 0 6 ; c ; f -> Enable/disable Special Color Number c. 1864 The second parameter tells xterm to enable the corresponding 1865 color mode if nonzero, disable it if zero. 1866 1867 Pc = 0 <- resource colorBDMode (BOLD). 1868 Pc = 1 <- resource colorULMode (UNDERLINE). 1869 Pc = 2 <- resource colorBLMode (BLINK). 1870 Pc = 3 <- resource colorRVMode (REVERSE). 1871 Pc = 4 <- resource colorITMode (ITALIC). 1872 Pc = 5 <- resource colorAttrMode (Override ANSI). 1873 1874 If no parameters are given, this control has no effect. 1875 1876 The dynamic colors can also be reset to their default 1877 (resource) values: 1878 Ps = 1 1 0 -> Reset VT100 text foreground color. 1879 Ps = 1 1 1 -> Reset VT100 text background color. 1880 Ps = 1 1 2 -> Reset text cursor color. 1881 Ps = 1 1 3 -> Reset pointer foreground color. 1882 Ps = 1 1 4 -> Reset pointer background color. 1883 Ps = 1 1 5 -> Reset Tektronix foreground color. 1884 Ps = 1 1 6 -> Reset Tektronix background color. 1885 Ps = 1 1 7 -> Reset highlight color. 1886 Ps = 1 1 8 -> Reset Tektronix cursor color. 1887 Ps = 1 1 9 -> Reset highlight foreground color. 1888 1889 Ps = I ; c -> Set icon to file. Sun shelltool, CDE dtterm. 1890 The file is expected to be XPM format, and uses the same 1891 search logic as the iconHint resource. 1892 1893 Ps = l ; c -> Set window title. Sun shelltool, CDE dtterm. 1894 1895 Ps = L ; c -> Set icon label. Sun shelltool, CDE dtterm. 1896 1897 1898Privacy Message 1899 1900PM Pt ST xterm implements no PM functions; Pt is ignored. Pt need not 1901 be printable characters. 1902 1903 1904Special Keyboard Keys 1905 1906Terminal keyboards have two types of keys: 1907 1908o ordinary keys, which you would use as data, e.g., in a text file, 1909 and 1910 1911o special keys, which you would use to tell xterm to perform some 1912 action. 1913 1914XTerm detects all of these keys via X key-press and key-release events. 1915It uses the translations resource to decide what to do with these 1916events. 1917 1918o Ordinary keys are handled with the insert-seven-bit or insert-eight- 1919 bit action. 1920 1921o Special keys may be handled with other resources. However, xterm 1922 also has built-in logic to map commonly-used special keys into 1923 characters which your keypress sends to the application running in 1924 xterm. 1925 1926Special keyboard keys send control characters or escape sequences. This 1927is a convention, making it convenient for applications to detect these 1928keys, rather than a standard. 1929 1930 1931Alt and Meta Keys 1932 1933Many keyboards have keys labeled "Alt". Few have keys labeled "Meta". 1934However, xterm's default translations use the Meta modifier. Common 1935keyboard configurations assign the Meta modifier to an "Alt" key. By 1936using xmodmap one may have the modifier assigned to a different key, and 1937have "real" alt and meta keys. Here is an example: 1938 1939 ! put meta on mod3 to distinguish it from alt 1940 keycode 64 = Alt_L 1941 clear mod1 1942 add mod1 = Alt_L 1943 keycode 115 = Meta_L 1944 clear mod3 1945 add mod3 = Meta_L 1946 1947 1948The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set) 1949can be used to control the way the Meta modifier applies to ordinary 1950keys unless the modifyOtherKeys resource is set: 1951 1952o prefix a key with the ESC character. 1953 1954o shift the key from codes 0-127 to 128-255 by adding 128. 1955 1956When modifyOtherKeys is set, ordinary keys may be sent as escape 1957sequences: 1958 1959o When modifyOtherKeys is set to 1, only the alt- and meta-modifiers 1960 apply. For example, alt-Tab sends CSI 2 7 ; 3 ; 9 ~ (the second 1961 parameter is "3" for alt, and the third parameter is the ASCII value 1962 of tab, "9"). 1963 1964o When modifyOtherKeys is set to 2, all of the modifiers apply. For 1965 example, shift-Tab sends CSI 2 7 ; 2 ; 9 ~ rather than CSI Z (the 1966 second parameter is "2" for shift). 1967 1968The formatOtherKeys resource tells n to change the format of the escape 1969sequences sent when modifyOtherKeys applies. When modifyOtherKeys is 1970set to 1, for example alt-Tab sends CSI 9 ; 3 u (changing the order of 1971parameters). One drawback to this format is that applications may 1972confuse it with CSI u (restore-cursor). 1973 1974The xterm FAQ sections 1975 1976 How can my program distinguish control-I from tab? 1977 1978 XTerm - "Other" Modified Keys 1979 1980go into greater detail on this topic. 1981 1982The table shows the result for a given character "x" with modifiers 1983according to the default translations with the resources set on or off. 1984This assumes altIsNotMeta is set: 1985 1986 key altSendsEscape metaSendsEscape result 1987 -----------+----------------+-----------------+------------ 1988 x | off | off | x 1989 Meta-x | off | off | shift 1990 Alt-x | off | off | shift 1991 Alt+Meta-x | off | off | shift 1992 x | ON | off | x 1993 Meta-x | ON | off | shift 1994 Alt-x | ON | off | ESC x 1995 Alt+Meta-x | ON | off | ESC shift 1996 x | off | ON | x 1997 Meta-x | off | ON | ESC x 1998 Alt-x | off | ON | shift 1999 Alt+Meta-x | off | ON | ESC shift 2000 x | ON | ON | x 2001 Meta-x | ON | ON | ESC x 2002 Alt-x | ON | ON | ESC x 2003 Alt+Meta-x | ON | ON | ESC x 2004 -----------+----------------+-----------------+------------ 2005 2006 2007 2008PC-Style Function Keys 2009 2010If xterm does minimal translation of the function keys, it usually does 2011this with a PC-style keyboard, so PC-style function keys result. Sun 2012keyboards are similar to PC keyboards. Both have cursor and scrolling 2013operations printed on the keypad, which duplicate the smaller cursor and 2014scrolling keypads. 2015 2016X does not predefine NumLock (used for VT220 keyboards) or Alt (used as 2017an extension for the Sun/PC keyboards) as modifiers. These keys are 2018recognized as modifiers when enabled by the numLock resource, or by the 2019"DECSET 1 0 3 5 " control sequence. 2020 2021The cursor keys transmit the following escape sequences depending on the 2022mode specified via the DECCKM escape sequence. 2023 2024 Key Normal Application 2025 -------------+----------+------------- 2026 Cursor Up | CSI A | SS3 A 2027 Cursor Down | CSI B | SS3 B 2028 Cursor Right | CSI C | SS3 C 2029 Cursor Left | CSI D | SS3 D 2030 -------------+----------+------------- 2031 2032The home- and end-keys (unlike PageUp and other keys also on the 6-key 2033editing keypad) are considered "cursor keys" by xterm. Their mode is 2034also controlled by the DECCKM escape sequence: 2035 2036 Key Normal Application 2037 ---------+----------+------------- 2038 Home | CSI H | SS3 H 2039 End | CSI F | SS3 F 2040 ---------+----------+------------- 2041 2042 2043The application keypad transmits the following escape sequences 2044depending on the mode specified via the DECKPNM and DECKPAM escape 2045sequences. Use the NumLock key to override the application mode. 2046 2047Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are 2048supported by the program. 2049 2050 Key Numeric Application Terminfo Termcap 2051 ---------------+----------+-------------+----------+---------- 2052 Space | SP | SS3 SP | - | - 2053 Tab | TAB | SS3 I | - | - 2054 Enter | CR | SS3 M | kent | @8 2055 PF1 | SS3 P | SS3 P | kf1 | k1 2056 PF2 | SS3 Q | SS3 Q | kf2 | k2 2057 PF3 | SS3 R | SS3 R | kf3 | k3 2058 PF4 | SS3 S | SS3 S | kf4 | k4 2059 * (multiply) | * | SS3 j | - | - 2060 + (add) | + | SS3 k | - | - 2061 , (comma) | , | SS3 l | - | - 2062 - (minus) | - | SS3 m | - | - 2063 . (Delete) | . | CSI 3 ~ | - | - 2064 / (divide) | / | SS3 o | - | - 2065 0 (Insert) | 0 | CSI 2 ~ | - | - 2066 1 (End) | 1 | SS3 F | kc1 | K4 2067 2 (DownArrow) | 2 | CSI B | - | - 2068 3 (PageDown) | 3 | CSI 6 ~ | kc3 | K5 2069 4 (LeftArrow) | 4 | CSI D | - | - 2070 5 (Begin) | 5 | CSI E | kb2 | K2 2071 6 (RightArrow) | 6 | CSI C | - | - 2072 7 (Home) | 7 | SS3 H | ka1 | K1 2073 8 (UpArrow) | 8 | CSI A | - | - 2074 9 (PageUp) | 9 | CSI 5 ~ | ka3 | K3 2075 = (equal) | = | SS3 X | - | - 2076 ---------------+----------+-------------+----------+---------- 2077 2078They also provide 12 function keys, as well as a few other special- 2079purpose keys: 2080 2081 Key Escape Sequence 2082 ---------+----------------- 2083 F1 | SS3 P 2084 F2 | SS3 Q 2085 F3 | SS3 R 2086 F4 | SS3 S 2087 F5 | CSI 1 5 ~ 2088 F6 | CSI 1 7 ~ 2089 F7 | CSI 1 8 ~ 2090 F8 | CSI 1 9 ~ 2091 F9 | CSI 2 0 ~ 2092 F10 | CSI 2 1 ~ 2093 F11 | CSI 2 3 ~ 2094 F12 | CSI 2 4 ~ 2095 ---------+----------------- 2096 2097 2098Note that F1 through F4 are prefixed with SS3 , while the other keys are 2099prefixed with CSI . Older versions of xterm implement different escape 2100sequences for F1 through F4, with a CSI prefix. These can be activated 2101by setting the oldXtermFKeys resource. However, since they do not 2102correspond to any hardware terminal, they have been deprecated. (The 2103DEC VT220 reserves F1 through F5 for local functions such as Setup). 2104 2105 Key Escape Sequence 2106 ---------+----------------- 2107 F1 | CSI 1 1 ~ 2108 F2 | CSI 1 2 ~ 2109 F3 | CSI 1 3 ~ 2110 F4 | CSI 1 4 ~ 2111 ---------+----------------- 2112 2113In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is 2114false (and none of the other keyboard resources such as oldXtermFKeys 2115resource is set), xterm encodes function key modifiers as parameters 2116appended before the final character of the control sequence. As a 2117special case, the SS3 sent before F1 through F4 is altered to CSI when 2118sending a function key modifier as a parameter. 2119 2120 Code Modifiers 2121 ---------+--------------------------- 2122 2 | Shift 2123 3 | Alt 2124 4 | Shift + Alt 2125 5 | Control 2126 6 | Shift + Control 2127 7 | Alt + Control 2128 8 | Shift + Alt + Control 2129 9 | Meta 2130 10 | Meta + Shift 2131 11 | Meta + Alt 2132 12 | Meta + Alt + Shift 2133 13 | Meta + Ctrl 2134 14 | Meta + Ctrl + Shift 2135 15 | Meta + Ctrl + Alt 2136 16 | Meta + Ctrl + Alt + Shift 2137 ---------+--------------------------- 2138 2139For example, shift-F5 would be sent as CSI 1 5 ; 2 ~ 2140 2141If the alwaysUseMods resource is set, the Meta modifier also is 2142recognized, making parameters 9 through 16. 2143 2144The codes used for the PC-style function keys were inspired by a feature 2145of the VT510, referred to in its reference manual as DECFNK. In the 2146DECFNK scheme, codes 2-8 identify modifiers for function-keys and 2147cursor-, editing-keypad keys. Unlike xterm, the VT510 limits the 2148modifiers which can be used with cursor- and editing-keypad keys. 2149Although the name "DECFNK" implies that it is a mode, the VT510 manual 2150mentions it only as a feature, which (like xterm) interacts with the 2151DECUDK feature. Unlike xterm, VT510/VT520 provide an extension to 2152DECUDK (DECPFK and DECPAK) which apparently was the reason for the 2153feature in those terminals, i.e., for identifying a programmable key 2154rather than making it simple for applications to obtain modifier 2155information. It is not described in the related VT520 manual. Neither 2156manual was readily available at the time the feature was added to xterm. 2157 2158On the other hand, the VT510 and VT520 reference manuals do document a 2159related feature. That is its emulation of the SCO console, which is 2160similar to the "xterm-sco" terminal description. The SCO console 2161function-keys are less useful to applications developers than the 2162approach used by xterm because 2163 2164o the relationship between modifiers and the characters sent by 2165 function-keys is not readily apparent, and 2166 2167o the scheme is not extensible, i.e., it is an ad hoc assignment 2168 limited to two modifiers (shift and control). 2169 2170 2171VT220-Style Function Keys 2172 2173However, xterm is most useful as a DEC VT102 or VT220 emulator. Set the 2174sunKeyboard resource to true to force a Sun/PC keyboard to act like a 2175VT220 keyboard. 2176 2177The VT102/VT220 application keypad transmits unique escape sequences in 2178application mode, which are distinct from the cursor and scrolling 2179keypad: 2180 2181 Key Numeric Application VT100? 2182 -------------+----------+-------------+---------- 2183 Space | SP | SS3 SP | no 2184 Tab | TAB | SS3 I | no 2185 Enter | CR | SS3 M | yes 2186 PF1 | SS3 P | SS3 P | yes 2187 PF2 | SS3 Q | SS3 Q | yes 2188 PF3 | SS3 R | SS3 R | yes 2189 PF4 | SS3 S | SS3 S | yes 2190 * (multiply) | * | SS3 j | no 2191 + (add) | + | SS3 k | no 2192 , (comma) | , | SS3 l | yes 2193 - (minus) | - | SS3 m | yes 2194 . (period) | . | SS3 n | yes 2195 / (divide) | / | SS3 o | no 2196 0 | 0 | SS3 p | yes 2197 1 | 1 | SS3 q | yes 2198 2 | 2 | SS3 r | yes 2199 3 | 3 | SS3 s | yes 2200 4 | 4 | SS3 t | yes 2201 5 | 5 | SS3 u | yes 2202 6 | 6 | SS3 v | yes 2203 7 | 7 | SS3 w | yes 2204 8 | 8 | SS3 x | yes 2205 9 | 9 | SS3 y | yes 2206 = (equal) | = | SS3 X | no 2207 -------------+----------+-------------+---------- 2208 2209 2210The VT100/VT220 keypad did not have all of those keys. They were 2211implemented in xterm in X11R1 (1987), defining a mapping of all X11 keys 2212which might be provided on a keypad. For instance, a Sun4/II type-4 2213keyboard provided "=" (equal), "/" (divide), and "*" (multiply). 2214 2215While the VT420 provided the same keypad, the VT520 used a PC-keyboard. 2216Because that keyboard's keypad lacks the "," (comma), it was not 2217possible to use EDT's delete-character function with the keypad. XTerm 2218solves that problem for the VT220-keyboard configuration by mapping 2219 2220 Ctrl + to , and 2221 Ctrl - to - 2222 2223The VT220 provides a 6-key editing keypad, which is analogous to that on 2224the PC keyboard. It is not affected by DECCKM or DECKPNM/DECKPAM: 2225 2226 Key Normal Application 2227 ---------+----------+------------- 2228 Insert | CSI 2 ~ | CSI 2 ~ 2229 Delete | CSI 3 ~ | CSI 3 ~ 2230 Home | CSI 1 ~ | CSI 1 ~ 2231 End | CSI 4 ~ | CSI 4 ~ 2232 PageUp | CSI 5 ~ | CSI 5 ~ 2233 PageDown | CSI 6 ~ | CSI 6 ~ 2234 ---------+----------+------------- 2235 2236 2237The VT220 provides 8 additional function keys. With a Sun/PC keyboard, 2238access these keys by Control/F1 for F13, etc. 2239 2240 Key Escape Sequence 2241 ---------+----------------- 2242 F13 | CSI 2 5 ~ 2243 F14 | CSI 2 6 ~ 2244 F15 | CSI 2 8 ~ 2245 F16 | CSI 2 9 ~ 2246 F17 | CSI 3 1 ~ 2247 F18 | CSI 3 2 ~ 2248 F19 | CSI 3 3 ~ 2249 F20 | CSI 3 4 ~ 2250 ---------+----------------- 2251 2252 2253 2254VT52-Style Function Keys 2255 2256A VT52 does not have function keys, but it does have a numeric keypad 2257and cursor keys. They differ from the other emulations by the prefix. 2258Also, the cursor keys do not change: 2259 2260 Key Normal/Application 2261 -------------+-------------------- 2262 Cursor Up | ESC A 2263 Cursor Down | ESC B 2264 Cursor Right | ESC C 2265 Cursor Left | ESC D 2266 -------------+-------------------- 2267 2268The keypad is similar: 2269 2270 Key Numeric Application VT52? 2271 -------------+----------+-------------+---------- 2272 Space | SP | ESC ? SP | no 2273 Tab | TAB | ESC ? I | no 2274 Enter | CR | ESC ? M | no 2275 PF1 | ESC P | ESC P | yes 2276 PF2 | ESC Q | ESC Q | yes 2277 PF3 | ESC R | ESC R | yes 2278 PF4 | ESC S | ESC S | no 2279 * (multiply) | * | ESC ? j | no 2280 + (add) | + | ESC ? k | no 2281 , (comma) | , | ESC ? l | no 2282 - (minus) | - | ESC ? m | no 2283 . (period) | . | ESC ? n | yes 2284 / (divide) | / | ESC ? o | no 2285 0 | 0 | ESC ? p | yes 2286 1 | 1 | ESC ? q | yes 2287 2 | 2 | ESC ? r | yes 2288 3 | 3 | ESC ? s | yes 2289 4 | 4 | ESC ? t | yes 2290 5 | 5 | ESC ? u | yes 2291 6 | 6 | ESC ? v | yes 2292 7 | 7 | ESC ? w | yes 2293 8 | 8 | ESC ? x | yes 2294 9 | 9 | ESC ? y | yes 2295 = (equal) | = | ESC ? X | no 2296 -------------+----------+-------------+---------- 2297 2298 2299 2300Sun-Style Function Keys 2301 2302The xterm program provides support for Sun keyboards more directly, by a 2303menu toggle that causes it to send Sun-style function key codes rather 2304than VT220. Note, however, that the sun and VT100 emulations are not 2305really compatible. For example, their wrap-margin behavior differs. 2306 2307Only function keys are altered; keypad and cursor keys are the same. 2308The emulation responds identically. See the xterm-sun terminfo entry 2309for details. 2310 2311 2312HP-Style Function Keys 2313 2314Similarly, xterm can be compiled to support HP keyboards. See the 2315xterm-hp terminfo entry for details. 2316 2317 2318Non-Function Keys 2319 2320On a DEC terminal keyboard, some of the keys which one would expect to 2321see labeled as function keys had special names. The keys actually send 2322character sequences as if they were the expected function keys, but the 2323special names are used in documentation. Because other keyboards may 2324use those names, xterm maps the X key symbols which have the 2325corresponding names into the character sequences which the original DEC 2326keyboard would send. 2327 2328These mappings are used for the DEC (VT220) and other keyboards: 2329 2330 Label DEC SUN HP SCO 2331 --------------+------------+--------------+----------+---------- 2332 Up | SS3 A | SS3 A | ESC A | CSI A 2333 Down | SS3 B | SS3 B | ESC B | CSI B 2334 Right | SS3 C | SS3 C | ESC C | CSI C 2335 Left | SS3 D | SS3 D | ESC D | CSI D 2336 Clear | - | - | ESC J | - 2337 Find | CSI 1 ~ | CSI 1 z | ESC h | - 2338 Insert | CSI 2 ~ | CSI 2 z | ESC Q | CSI L 2339 Delete | CSI 3 ~ | CSI 3 z | ESC P | - 2340 Keypad Insert | CSI 2 ~ | CSI 2 z | ESC Q | CSI L 2341 Keypad Delete | CSI 3 ~ | CSI 3 z | ESC P | - 2342 Remove | CSI 3 ~ | CSI 3 z | ESC P | - 2343 Select | CSI 4 ~ | CSI 4 z | ESC F | - 2344 Prior | CSI 5 ~ | CSI 2 1 6 z | ESC T | CSI I 2345 Next | CSI 6 ~ | CSI 2 2 2 z | ESC S | CSI G 2346 Help | CSI 2 8 ~ | CSI 1 9 6 z | - | - 2347 Menu | CSI 2 9 ~ | CSI 1 9 7 z | - | - 2348 Home | - | CSI 2 1 4 z | ESC h | CSI H 2349 End | - | CSI 2 2 0 z | ESC F | CSI F 2350 Begin | - | CSI 2 1 8 z | - | CSI E 2351 --------------+------------+--------------+----------+---------- 2352 2353 2354 2355The Alternate Screen Buffer 2356 2357XTerm maintains two screen buffers. The Normal Screen Buffer allows you 2358to scroll back to view saved lines of output up to the maximum set by 2359the saveLines resource. The Alternate Screen Buffer is exactly as large 2360as the display, contains no additional saved lines. When the Alternate 2361Screen Buffer is active, you cannot scroll back to view saved lines. 2362XTerm provides control sequences and menu entries for switching between 2363the two. 2364 2365Most full-screen applications use terminfo or termcap to obtain strings 2366used to start/stop full-screen mode, i.e., smcup and rmcup for terminfo, 2367or the corresponding ti and te for termcap. The titeInhibit resource 2368removes the ti and te strings from the TERMCAP string which is set in 2369the environment for some platforms. That is not done when xterm is 2370built with terminfo libraries because terminfo does not provide the 2371whole text of the termcap data in one piece. It would not work for 2372terminfo anyway, since terminfo data is not passed in environment 2373variables; setting an environment variable in this manner would have no 2374effect on the application's ability to switch between Normal and 2375Alternate Screen buffers. Instead, the newer private mode controls 2376(such as 1 0 4 9 ) for switching between Normal and Alternate Screen 2377buffers simply disable the switching. They add other features such as 2378clearing the display for the same reason: to make the details of 2379switching independent of the application that requests the switch. 2380 2381 2382Bracketed Paste Mode 2383 2384When bracketed paste mode is set, pasted text is bracketed with control 2385sequences so that the program can differentiate pasted text from typed- 2386in text. When bracketed paste mode is set, the program will receive: 2387 ESC [ 2 0 0 ~ , 2388followed by the pasted text, followed by 2389 ESC [ 2 0 1 ~ . 2390 2391 2392Title Modes 2393 2394The window- and icon-labels can be set or queried using control 2395sequences. As a VT220-emulator, xterm "should" limit the character 2396encoding for the corresponding strings to ISO-8859-1. Indeed, it used 2397to be the case (and was documented) that window titles had to be 2398ISO-8859-1. This is no longer the case. However, there are many 2399applications which still assume that titles are set using ISO-8859-1. 2400So that is the default behavior. 2401 2402If xterm is running with UTF-8 encoding, it is possible to use window- 2403and icon-labels encoded using UTF-8. That is because the underlying X 2404libraries (and many, but not all) window managers support this feature. 2405 2406The utf8Title X resource setting tells xterm to disable a reconversion 2407of the title string back to ISO-8859-1, allowing the title strings to be 2408interpreted as UTF-8. The same feature can be enabled using the title 2409mode control sequence described in this summary. 2410 2411Separate from the ability to set the titles, xterm provides the ability 2412to query the titles, returning them either in ISO-8859-1 or UTF-8. This 2413choice is available only while xterm is using UTF-8 encoding. 2414 2415Finally, the characters sent to, or returned by a title control are less 2416constrained than the rest of the control sequences. To make them more 2417manageable (and constrained), for use in shell scripts, xterm has an 2418optional feature which decodes the string from hexadecimal (for setting 2419titles) or for encoding the title into hexadecimal when querying the 2420value. 2421 2422 2423Mouse Tracking 2424 2425The VT widget can be set to send the mouse position and other 2426information on button presses. These modes are typically used by 2427editors and other full-screen applications that want to make use of the 2428mouse. 2429 2430There are two sets of mutually exclusive modes: 2431 2432o mouse protocol 2433 2434o protocol encoding 2435 2436The mouse protocols include DEC Locator mode, enabled by the DECELR CSI 2437Ps ; Ps ' z control sequence, and is not described here (control 2438sequences are summarized above). The remaining five modes of the mouse 2439protocols are each enabled (or disabled) by a different parameter in the 2440"DECSET CSI ? Pm h " or "DECRST CSI ? Pm l " control sequence. 2441 2442Manifest constants for the parameter values are defined in xcharmouse.h 2443as follows: 2444 2445 #define SET_X10_MOUSE 9 2446 #define SET_VT200_MOUSE 1000 2447 #define SET_VT200_HIGHLIGHT_MOUSE 1001 2448 #define SET_BTN_EVENT_MOUSE 1002 2449 #define SET_ANY_EVENT_MOUSE 1003 2450 2451 #define SET_FOCUS_EVENT_MOUSE 1004 2452 2453 #define SET_ALTERNATE_SCROLL 1007 2454 2455 #define SET_EXT_MODE_MOUSE 1005 2456 #define SET_SGR_EXT_MODE_MOUSE 1006 2457 #define SET_URXVT_EXT_MODE_MOUSE 1015 2458 #define SET_PIXEL_POSITION_MOUSE 1016 2459 2460The motion reporting modes are strictly xterm extensions, and are not 2461part of any standard, though they are analogous to the DEC VT200 DECELR 2462locator reports. 2463 2464Normally, parameters (such as pointer position and button number) for 2465all mouse tracking escape sequences generated by xterm encode numeric 2466parameters in a single character as value+32. For example, ! specifies 2467the value 1. The upper left character position on the terminal is 2468denoted as 1,1. This scheme dates back to X10, though the normal mouse- 2469tracking (from X11) is more elaborate. 2470 2471 2472X10 compatibility mode 2473 2474X10 compatibility mode sends an escape sequence only on button press, 2475encoding the location and the mouse button pressed. It is enabled by 2476specifying parameter 9 to DECSET. On button press, xterm sends CSI M 2477CbCxCy (6 characters). 2478 2479o Cb is button-1, where button is 1, 2 or 3. 2480 2481o Cx and Cy are the x and y coordinates of the mouse when the button 2482 was pressed. 2483 2484 2485Normal tracking mode 2486 2487Normal tracking mode sends an escape sequence on both button press and 2488release. Modifier key (shift, ctrl, meta) information is also sent. It 2489is enabled by specifying parameter 1000 to DECSET. On button press or 2490release, xterm sends CSI M CbCxCy. 2491 2492o The low two bits of Cb encode button information: 2493 2494 0=MB1 pressed, 2495 1=MB2 pressed, 2496 2=MB3 pressed, and 2497 3=release. 2498 2499o The next three bits encode the modifiers which were down when the 2500 button was pressed and are added together: 2501 2502 4=Shift, 2503 8=Meta, and 2504 16=Control. 2505 2506 The shift and control modifiers are normally irrelevant because 2507 xterm uses the control modifier with mouse for popup menus, and the 2508 shift modifier is used in the default translations for button 2509 events. 2510 2511 There is no predefined meta modifier. XTerm checks first if the 2512 keysyms listed in the predefined modifiers include Meta_L or Meta_R. 2513 If found, xterm uses that modifier for meta. Next, it tries Alt_L 2514 or Alt_R. If none of those are found, xterm uses the mod1 modifier, 2515 This is not necessarily the "Meta" key according to xmodmap(1). 2516 2517o Cx and Cy are the x and y coordinates of the mouse event, encoded as 2518 in X10 mode. 2519 2520 2521Wheel mice 2522 2523Wheel mice may return buttons 4 and 5. Those buttons are represented by 2524the same event codes as buttons 1 and 2 respectively, except that 64 is 2525added to the event code. Release events for the wheel buttons are not 2526reported. 2527 2528By default, the wheel mouse events (buttons 4 and 5) are translated to 2529scroll-back and scroll-forw actions, respectively. Those actions 2530normally scroll the whole window, as if the scrollbar was used. 2531 2532However if Alternate Scroll mode is set, then cursor up/down controls 2533are sent when the terminal is displaying the Alternate Screen Buffer. 2534The initial state of Alternate Scroll mode is set using the 2535alternateScroll resource. 2536 2537 2538Other buttons 2539 2540Some wheel mice can send additional button events, e.g., by tilting the 2541scroll wheel left and right. 2542 2543Additional buttons are encoded like the wheel mice, 2544 2545o by adding 64 (for buttons 6 and 7), or 2546 2547o by adding 128 (for buttons 8 through 11). 2548 2549Past button 11, the encoding is ambiguous because the same code may 2550correspond to different button/modifier combinations. 2551 2552It is not possible to use these buttons (6-11) in xterm's translations 2553resource because their names are not in the X Toolkit's symbol table. 2554However, applications can check for the reports, e.g., button 7 (left) 2555and button 6 (right) with a Logitech mouse. 2556 2557 2558Highlight tracking 2559 2560Mouse highlight tracking notifies a program of a button press, receives 2561a range of lines from the program, highlights the region covered by the 2562mouse within that range until button release, and then sends the program 2563the release coordinates. It is enabled by specifying parameter 1001 to 2564DECSET. Highlighting is performed only for button 1, though other 2565button events can be received. 2566 2567Warning: this mode requires a cooperating program, else xterm will hang. 2568 2569On button press, the same information as for normal tracking is 2570generated; xterm then waits for the program to send mouse tracking 2571information. All X events are ignored until the proper escape sequence 2572is received from the pty: 2573CSI Ps ; Ps ; Ps ; Ps ; Ps T 2574 2575The parameters are func, startx, starty, firstrow, and lastrow: 2576 2577o func is non-zero to initiate highlight tracking and zero to abort. 2578 2579o startx and starty give the starting x and y location for the 2580 highlighted region. 2581 2582o The ending location tracks the mouse, but will never be above row 2583 firstrow and will always be above row lastrow. (The top of the 2584 screen is row 1.) 2585 2586When the button is released, xterm reports the ending position one of 2587two ways: 2588 2589o if the start and end coordinates are the same locations: 2590 2591 CSI t CxCy 2592 2593o otherwise: 2594 2595 CSI T CxCyCxCyCxCy 2596 2597The parameters are startx, starty, endx, endy, mousex, and mousey: 2598 2599o startx, starty, endx, and endy give the starting and ending 2600 character positions of the region. 2601 2602o mousex and mousey give the location of the mouse at button up, which 2603 may not be over a character. 2604 2605 2606Button-event tracking 2607 2608Button-event tracking is essentially the same as normal tracking, but 2609xterm also reports button-motion events. Motion events are reported 2610only if the mouse pointer has moved to a different character cell. It 2611is enabled by specifying parameter 1002 to DECSET. On button press or 2612release, xterm sends the same codes used by normal tracking mode. 2613 2614o On button-motion events, xterm adds 32 to the event code (the third 2615 character, Cb). 2616 2617o The other bits of the event code specify button and modifier keys as 2618 in normal mode. For example, motion into cell x,y with button 1 2619 down is reported as 2620 2621 CSI M @ CxCy 2622 2623 ( @ = 32 + 0 (button 1) + 32 (motion indicator) ). Similarly, 2624 motion with button 3 down is reported as 2625 2626 CSI M B CxCy 2627 2628 ( B = 32 + 2 (button 3) + 32 (motion indicator) ). 2629 2630 2631Any-event tracking 2632 2633Any-event mode is the same as button-event mode, except that all motion 2634events are reported, even if no mouse button is down. It is enabled by 2635specifying 1003 to DECSET. 2636 2637 2638FocusIn/FocusOut 2639 2640FocusIn/FocusOut can be combined with any of the mouse events since it 2641uses a different protocol. When set, it causes xterm to send CSI I 2642when the terminal gains focus, and CSI O when it loses focus. 2643 2644 2645Extended coordinates 2646 2647The original X10 mouse protocol limits the Cx and Cy ordinates to 223 2648(=255 - 32). XTerm supports more than one scheme for extending this 2649range, by changing the protocol encoding: 2650 2651UTF-8 (1005) 2652 This enables UTF-8 encoding for Cx and Cy under all tracking 2653 modes, expanding the maximum encodable position from 223 to 2654 2015. For positions less than 95, the resulting output is 2655 identical under both modes. Under extended mouse mode, 2656 positions greater than 95 generate "extra" bytes which will 2657 confuse applications which do not treat their input as a UTF-8 2658 stream. Likewise, Cb will be UTF-8 encoded, to reduce 2659 confusion with wheel mouse events. 2660 2661 Under normal mouse mode, positions outside (160,94) result in 2662 byte pairs which can be interpreted as a single UTF-8 2663 character; applications which do treat their input as UTF-8 2664 will almost certainly be confused unless extended mouse mode 2665 is active. 2666 2667 This scheme has the drawback that the encoded coordinates will 2668 not pass through luit(1) unchanged, e.g., for locales using 2669 non-UTF-8 encoding. 2670 2671SGR (1006) 2672 The normal mouse response is altered to use 2673 2674 o CSI < followed by semicolon-separated 2675 2676 o encoded button value, 2677 2678 o Px and Py ordinates and 2679 2680 o a final character which is M for button press and m for 2681 button release. 2682 2683 The encoded button value in this case does not add 32 since 2684 that was useful only in the X10 scheme for ensuring that the 2685 byte containing the button value is a printable code. 2686 2687 o The modifiers are encoded in the same way. 2688 2689 o A different final character is used for button release to 2690 resolve the X10 ambiguity regarding which button was 2691 released. 2692 2693 The highlight tracking responses are also modified to an SGR- 2694 like format, using the same SGR-style scheme and button- 2695 encodings. 2696 2697URXVT (1015) 2698 The normal mouse response is altered to use 2699 2700 o CSI followed by semicolon-separated 2701 2702 o encoded button value, 2703 2704 o the Px and Py ordinates and final character M . 2705 2706 This uses the same button encoding as X10, but printing it as 2707 a decimal integer rather than as a single byte. 2708 2709 However, CSI M can be mistaken for DL (delete lines), while 2710 the highlight tracking CSI T can be mistaken for SD (scroll 2711 down), and the Window manipulation controls. For these 2712 reasons, the 1015 control is not recommended; it is not an 2713 improvement over 1006. 2714 2715SGR-Pixels (1016) 2716 Use the same mouse response format as the 1006 control, but 2717 report position in pixels rather than character cells. 2718 2719 2720Graphics 2721 2722 2723Sixel Graphics 2724 2725If xterm is configured as VT240, VT241, VT330, VT340 or VT382 using the 2726decTerminalID or decGraphicsID resource, it supports Sixel Graphics 2727controls, a palleted bitmap graphics system using sets of six vertical 2728pixels as the basic element. 2729 2730CSI Ps c Send Device Attributes (Primary DA), xterm. xterm responds to 2731 Send Device Attributes (Primary DA) with these additional 2732 codes: 2733 Ps = 4 -> Sixel graphics. 2734 2735CSI ? Pm h 2736 Set Mode, xterm. xterm has these additional private Set Mode 2737 values: 2738 Ps = 8 0 -> Sixel scrolling. 2739 Ps = 1 0 7 0 -> use private color registers for each 2740 graphic. 2741 Ps = 8 4 5 2 -> Sixel scrolling leaves cursor to right of 2742 graphic. 2743 2744DCS Pa ; Pb ; Ph q Ps..Ps ST 2745 Send SIXEL image, DEC graphics terminals, xterm. See: 2746 2747 VT330/VT340 Programmer Reference Manual Volume 2: 2748 Graphics Programming 2749 Chapter 14 Graphics Programming 2750 2751 The sixel data device control string has three positional 2752 parameters, following the q with sixel data. 2753 Pa -> pixel aspect ratio 2754 Pb -> background color option 2755 Ph -> horizontal grid size (ignored). 2756 Ps -> sixel data 2757 2758 2759ReGIS Graphics 2760 2761If xterm is configured as VT125, VT240, VT241, VT330 or VT340 using the 2762decTerminalID or decGraphicsID resource, it supports Remote Graphic 2763Instruction Set, a graphics description language. 2764 2765CSI Ps c Send Device Attributes (Primary DA), DEC graphics terminals, 2766 xterm. xterm responds to Send Device Attributes (Primary DA) 2767 with these additional codes: 2768 Ps = 3 -> ReGIS graphics. 2769 2770CSI ? Pm h 2771 Set Mode, xterm. xterm has these additional private Set Mode 2772 values: 2773 Ps = 1 0 7 0 -> use private color registers for each 2774 graphic. 2775 2776DCS Pm p Pr..Pr ST 2777 Enter or exit ReGIS, VT300, xterm. See: 2778 2779 VT330/VT340 Programmer Reference Manual Volume 2: 2780 Graphics Programming 2781 Chapter 1 Introduction to ReGIS 2782 2783 The ReGIS data device control string has one positional 2784 parameter with four possible values: 2785 Pm = 0 -> resume command, use fullscreen mode. 2786 Pm = 1 -> start new command, use fullscreen mode. 2787 Pm = 2 -> resume command, use command display mode. 2788 Pm = 3 -> start new command, use command display mode. 2789 2790 2791Non-VT100 Modes 2792 2793 2794Tektronix 4014 Mode 2795 2796Most of these sequences are standard Tektronix 4014 control sequences. 2797Graph mode supports the 12-bit addressing of the Tektronix 4014. The 2798major features missing are the write-through and defocused modes. This 2799document does not describe the commands used in the various Tektronix 2800plotting modes but does describe the commands to switch modes. 2801 2802Some of the sequences are specific to xterm. The Tektronix emulation 2803was added in X10R4 (1986). The VT240, introduced two years earlier, 2804also supported Tektronix 4010/4014. Unlike xterm, the VT240 2805documentation implies (there is an obvious error in section 6.9 2806"Entering and Exiting 4010/4014 Mode") that exiting back to ANSI mode is 2807done by resetting private mode 3 8 (DECTEK) rather than ESC ETX . A 2808real Tektronix 4014 would not respond to either. 2809 2810BEL Bell (Ctrl-G). 2811 2812BS Backspace (Ctrl-H). 2813 2814TAB Horizontal Tab (Ctrl-I). 2815 2816LF Line Feed or New Line (Ctrl-J). 2817 2818VT Cursor up (Ctrl-K). 2819 2820FF Form Feed or New Page (Ctrl-L). 2821 2822CR Carriage Return (Ctrl-M). 2823 2824ESC ETX Switch to VT100 Mode (ESC Ctrl-C). 2825 2826ESC ENQ Return Terminal Status (ESC Ctrl-E). 2827 2828ESC FF PAGE (Clear Screen) (ESC Ctrl-L). 2829 2830ESC SO Begin 4015 APL mode (ESC Ctrl-N). This is ignored by xterm. 2831 2832ESC SI End 4015 APL mode (ESC Ctrl-O). This is ignored by xterm. 2833 2834ESC ETB COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss). 2835 ETB (end transmission block) is the same as Ctrl-W. 2836 2837ESC CAN Bypass Condition (ESC Ctrl-X). 2838 2839ESC SUB GIN mode (ESC Ctrl-Z). 2840 2841ESC FS Special Point Plot Mode (ESC Ctrl-\). 2842 2843ESC 8 Select Large Character Set. 2844 2845ESC 9 Select #2 Character Set. 2846 2847ESC : Select #3 Character Set. 2848 2849ESC ; Select Small Character Set. 2850 2851OSC Ps ; Pt BEL 2852 Set Text Parameters of VT window. 2853 Ps = 0 -> Change Icon Name and Window Title to Pt. 2854 Ps = 1 -> Change Icon Name to Pt. 2855 Ps = 2 -> Change Window Title to Pt. 2856 Ps = 4 6 -> Change Log File to Pt. This is normally 2857 disabled by a compile-time option. 2858 2859ESC ` Normal Z Axis and Normal (solid) Vectors. 2860 2861ESC a Normal Z Axis and Dotted Line Vectors. 2862 2863ESC b Normal Z Axis and Dot-Dashed Vectors. 2864 2865ESC c Normal Z Axis and Short-Dashed Vectors. 2866 2867ESC d Normal Z Axis and Long-Dashed Vectors. 2868 2869ESC h Defocused Z Axis and Normal (solid) Vectors. 2870 2871ESC i Defocused Z Axis and Dotted Line Vectors. 2872 2873ESC j Defocused Z Axis and Dot-Dashed Vectors. 2874 2875ESC k Defocused Z Axis and Short-Dashed Vectors. 2876 2877ESC l Defocused Z Axis and Long-Dashed Vectors. 2878 2879ESC p Write-Thru Mode and Normal (solid) Vectors. 2880 2881ESC q Write-Thru Mode and Dotted Line Vectors. 2882 2883ESC r Write-Thru Mode and Dot-Dashed Vectors. 2884 2885ESC s Write-Thru Mode and Short-Dashed Vectors. 2886 2887ESC t Write-Thru Mode and Long-Dashed Vectors. 2888 2889FS Point Plot Mode (Ctrl-\). 2890 2891GS Graph Mode (Ctrl-]). 2892 2893RS Incremental Plot Mode (Ctrl-^ ). 2894 2895US Alpha Mode (Ctrl-_). 2896 2897 2898VT52 Mode 2899 2900Parameters for cursor movement are at the end of the ESC Y escape 2901sequence. Each ordinate is encoded in a single character as value+32. 2902For example, ! is 1. The screen coordinate system is 0-based. 2903 2904ESC < Exit VT52 mode (Enter VT100 mode). 2905 2906ESC = Enter alternate keypad mode. 2907 2908ESC > Exit alternate keypad mode. 2909 2910ESC A Cursor up. 2911 2912ESC B Cursor down. 2913 2914ESC C Cursor right. 2915 2916ESC D Cursor left. 2917 2918ESC F Enter graphics mode. 2919 2920ESC G Exit graphics mode. 2921 2922ESC H Move the cursor to the home position. 2923 2924ESC I Reverse line feed. 2925 2926ESC J Erase from the cursor to the end of the screen. 2927 2928ESC K Erase from the cursor to the end of the line. 2929 2930ESC Y Ps Ps 2931 Move the cursor to given row and column. 2932 2933ESC Z Identify. 2934 -> ESC / Z ("I am a VT52."). 2935 2936 2937Further reading 2938 2939 2940Technical manuals 2941 2942Manuals for hardware terminals are more readily available than 2943similarly-detailed documentation for terminal emulators such as aixterm, 2944shelltool, dtterm. 2945 2946However long, the technical manuals have problems: 2947 2948o DEC's manuals did not provide a comprehensive comparison of the 2949 features in different model. 2950 2951 Peter Sichel's Host Interface Functions Checklist spreadsheet is 2952 useful for noting which model introduced a given feature (although 2953 there are a few apparent errors such as the DECRQSS feature cited 2954 for VT320 whereas the technical manual omits it). 2955 2956o Sometimes the manuals disagree. For example, DEC's standard 2957 document (DEC STD 070) for terminals says that DECSCL performs a 2958 soft reset (DECSTR), while the VT420 manual says it does a hard 2959 reset (RIS). 2960 2961o Sometimes the manuals are simply incorrect. For example, testing a 2962 DEC VT420 in 1996 showed that the documented code for a valid or 2963 invalid response to DECRQSS was reversed. 2964 2965 The VT420 test results were incorporated into vttest program. At 2966 the time, DEC STD 070 was not available, but it also agrees with 2967 vttest. Later, documentation for the DEC VT525 was shown to have 2968 the same flaw. 2969 2970o Not all details are clear even in DEC STD 070 (which is more than 2971 twice the length of the VT520 programmer's reference manual, and 2972 almost three times longer than the VT420 reference manual). 2973 However, as an internal standards document, DEC STD 070 is more 2974 likely to describe the actual behavior of DEC's terminals than the 2975 more polished user's guides. 2976 2977That said, here are technical manuals which have been used in developing 2978xterm. Not all were available initially. In August 1996 for instance, 2979the technical references were limited to EK-VT220-HR-002 and EK- 2980VT420-UG.002. Shortly after, Richard Shuford sent a copy of EK-VT3XX- 2981TP-001. Still later (beginning in 2003), Paul Williams' vt100.net site 2982provided EK-VT102-UG-003, EK-VT220-RM-002, EK-VT420-RM-002, EK-VT520-RM 2983A01, EK-VT100-TM-003, and EK-VT102-UG-003. In addition, several 2984documents were found on the bitsavers site. 2985 2986o DECscope User's Manual. 2987 Digital Equipment Corporation (EK-VT5X-OP-001 1975). 2988 2989o VT100 Series Video Terminal Technical Manual. 2990 Digital Equipment Corporation (EK-VT100-TM-003, July 1982). 2991 2992o VT100 User Guide. 2993 Digital Equipment Corporation (EK-VT100-UG-003, June 1981). 2994 2995o VT102 User Guide. 2996 Digital Equipment Corporation (EK-VT102-UG-003, February 1982). 2997 2998o VT220 Programmer Pocket Guide. 2999 Digital Equipment Corporation (EK-VT220-HR-002, July 1984). 3000 3001o VT220 Programmer Reference Manual. 3002 Digital Equipment Corporation (EK-VT220-RM-002, August 1984). 3003 3004o VT240 Programmer Reference Manual. 3005 Digital Equipment Corporation (EK-VT240-RM-002, October 1984). 3006 3007o VT330/VT340 Programmer Reference Manual 3008 Volume 1: Text Programming. 3009 Digital Equipment Corporation (EK-VT3XX-TP-001, March 1987). 3010 3011o VT330/VT340 Programmer Reference Manual 3012 Volume 2: Graphics Programming. 3013 Digital Equipment Corporation (EK-VT3XX-GP-001, March 1987). 3014 3015o VT330/VT340 Programmer Reference Manual 3016 Volume 2: Graphics Programming. 3017 Digital Equipment Corporation (EK-VT3XX-GP-002, May 1988). 3018 3019o VT382 Kanji Display Terminal 3020 Programmer Reference Manual. 3021 Digital Equipment Corporation (EK-VT382-RM-001). 3022 3023o VT382 Thai Display Terminal 3024 Installing and Using Manual. 3025 Digital Equipment Corporation (EK-VT38T-UG-001, August 1989). 3026 3027o Installing and Using 3028 The VT420 Video Terminal 3029 (North American Model). 3030 Digital Equipment Corporation (EK-VT420-UG.002, February 1990). 3031 3032o VT420 Programmer Reference Manual. 3033 Digital Equipment Corporation (EK-VT420-RM-002, February 1992). 3034 3035o VT510 Video Terminal 3036 Programmer Information. 3037 Digital Equipment Corporation (EK-VT510-RM B01, November 1993). 3038 3039o VT520/VT525 Video Terminal 3040 Programmer Information. 3041 Digital Equipment Corporation (EK-VT520-RM A01, July 1994). 3042 3043o Digital ANSI-Compliant Printing Protocol 3044 Level 2 Programming Reference Manual 3045 Digital Equipment Corporation (EK-PPLV2-PM B01, August 1994). 3046 3047o Disk Operating System 3048 DOS 2.00 3049 Microsoft, Inc. 3050 First edition, January 1983. 3051 3052o 4014 and 4014-1 Computer Display Terminal 3053 User's Manual. 3054 Tektronix, Inc. (070-1647-00, November 1979). 3055 3056 3057Standards 3058 3059The DEC terminal family (VT100 through VT525) is upward-compatible, 3060using standards plus extensions, e.g., "private modes". Not all 3061commonly-used features are standard. For example, scrolling regions are 3062not found in ECMA-48. On the other hand, ECMA-48 was not intended to 3063all-encompassing. Quoting from the second edition: 3064 3065 Full conformance to a standard means that all its requirements are 3066 met. For such conformance to be unique the standard must contain no 3067 options. This is typically the case for hardware standards, for 3068 instance Standard ECMA-10 for data interchange on punched tapes. 3069 3070 This Standard ECMA-48 is of a different nature and as a result, it 3071 is only practicable to envisage limited conformance to it, as 3072 defined hereunder. 3073 3074 This Standard addresses a whole class of devices which can vary 3075 greatly from each other depending on the application for which a 3076 device has been specifically designed. Obviously, a product which 3077 implements all facilities described in this standard - thus being in 3078 "full conformance" with it - whilst theoretically possible, would be 3079 technically and economically unthinkable. 3080 3081Again, it is possible to find discrepancies in the standards: 3082 3083o The printed ECMA-48 5th edition (1991) and the first PDF produced 3084 for that edition (April 1998) state that SD (scroll down) ends with 3085 05/14, i.e., ^ , which disagrees with DEC's VT420 hardware 3086 implementation and DEC's manuals which use 05/04 T . (A few other 3087 terminals such as AT&T 5620 and IBM 5151 also used 05/04, but the 3088 documentation and dates are lacking). 3089 3090 ECMA created a new PDF in April 2003 which changed that detail to 3091 use T , and later in 2008 provided PDFs of the earlier editions 3092 which used T . 3093 3094o The first edition of ECMA-48 has not been available, to compare. As 3095 of September 2021, ECMA's website provides a copy of ECMA-46 in its 3096 place. 3097 3098 Earlier versions of ISO 6429 have never been available. The first 3099 three editions of ISO 6429 were issued in 1983, 1988, and 1992. 3100 3101o ANSI X3.64-1979 does not list color as a feature of the SGR sequence 3102 (page 49). 3103 3104 In Appendix A, it mentions ECMA-48: 3105 3106 (8) This document represents a coordinated effort to develop a 3107 single technical standard in the United States and Europe (see 3108 ECMA-48 standard entitled Additional Controls for Character 3109 Imaging Input/Output Devices). 3110 3111 Appendix H clarifies the relationship between these documents 3112 somewhat though it confuses the first two editions of ECMA-48. The 3113 typo for "work" versus "owkr" appears in the original document: 3114 3115 ANSI X3.64-1979, and ECMA-48, Additional Controls for Character- 3116 Imaging I/O Devices, were developed in parallel, with close 3117 liaison. ISO DP 6429, Additional Control Functions for 3118 Character-Imaging Devices, was developed as a synthesis of X3.04 3119 and ECMA-48. During this process, some control functions as 3120 well as additional selective parameters were added. Except for 3121 point 1 below, X3.64 is a subset of ISO 6429. Although the two 3122 standards use different language, the intent is that the subset 3123 is technically identical. X3.64 was balloted and forwarded 3124 prior to the final resolution of ISO 6429 and does not 3125 incorporate the owkr of IS0/TC97/SC2 in completing ISO 6429. 3126 Revision of X3.64 will attempt to incorporate those elements and 3127 assumptions of X3.64. 3128 3129 ANSI X3.64 goes on to say that the SGR codes 8, 30-47 are in ISO 3130 6429. It includes 38 and 39, but omits 48 and 49. At the time, ISO 3131 6429's first edition was still four years in the future. The writer 3132 probably was referring to the ongoing process of making ECMA-48 3133 second edition into the ISO standard. 3134 3135o The VT320, VT420, VT520 manuals claim that DECSCL does a hard reset 3136 (RIS). 3137 3138 Both the VT220 manual and DEC STD 070 (which documents levels 1-4 in 3139 detail) state that it is a soft reset, e.g., DECSTR. 3140 3141o The VT330/VT340 reference manual for graphics programming documents 3142 sixel scrolling in some detail in chapter 14. The VT382 Kanji and 3143 Thai manuals provide less information, but differ in their comment 3144 about the private mode DECSDM (CSI ? 8 0 h ), which each manual 3145 agrees should set the Sixel Scrolling feature. However, the 3146 VT330/VT340 manual says 3147 3148 When sixel display mode is set, the Sixel Scrolling 3149 feature is enabled. 3150 3151 while the VT382 Kanji manual (page 6-6) says 3152 3153 Disable sixel scroll 3154 3155 and the VT382 Thai manual (page C-30) says 3156 3157 No Sixel scrolling 3158 3159 The standard (DEC STD 070) in chapter 9 (August 3, 1990) states on 3160 page 17 that video devices will scroll when advancing the Sixel 3161 active position past the bottom margin, but on page 19, in the 3162 section on deviations, states that VT125 and VT240 did not scroll in 3163 this situation. The standard does not mention VT330/VT340 or VT382. 3164 Nor does it document DECSDM. 3165 3166Here are the relevant standards: 3167 3168o Additional Controls for Use with American National Standard Code for 3169 Information Interchange, ANSI X3.64-1979 3170 FIPS Publication 86. July 18, 1979. 3171 American National Standards Institute, Inc. 3172 3173o ECMA-35: Character Code Structure and Extension Techniques 3174 (6th Edition, December 1994). 3175 3176o ECMA-43: 8-bit Coded Character Set Structure and Rules 3177 (3rd Edition, December 1991). 3178 3179o ECMA-48: Control Functions for Coded Character Sets 3180 (5th Edition, June 1991). 3181 3182o DEC STD 070 Video Systems Reference Manual. 3183 Digital Equipment Corporation (A-MN-ELSM070-00-0000 Rev H, December 3184 3, 1991). 3185 3186 3187Miscellaneous 3188 3189A few hardware terminals survived into the 1990s only as terminal 3190emulators. Documentation for these and other terminal emulators which 3191have influenced xterm are generally available only in less-accessible 3192and less-detailed manual pages. 3193 3194o XTerm supports control sequences for manipulating its window which 3195 were implemented by Sun's shelltool program. This was part of 3196 SunView (SunOS 3.0, 1986). The change-notes for xterm's resize 3197 program in X10.4 (1986) mention its use of these "Sun tty emulation 3198 escape sequences" for resizing the window. The X10.4 xterm program 3199 recognized these sequences for resizing the terminal, except for the 3200 iconify/deiconify pair. SunView also introduced the SIGWINCH 3201 signal, used by the X10.4 xterm and mentioned in its CHANGES file: 3202 3203 The window size is passed to the operating system via TIOCSWINSZ 3204 (4.3) or TIOCSSIZE (sun). A SIGWINCH signal is sent if the 3205 vtXXX window is resized. 3206 3207 While support for the Sun control-sequences remained in resize, the 3208 next release of xterm (X11R1 in 1987) omitted the code for 3209 interpreting them. 3210 3211 Later, the SunView program was adapted for the OPEN LOOK environment 3212 introduced 1988-1990. 3213 3214 Still later, in 1995, OPEN LOOK was abandoned in favor of CDE. The 3215 CDE terminal emulator dtterm implemented those controls, with a 3216 couple of additions. 3217 3218 Starting in July 1996, xterm re-implemented those control sequences 3219 (based on the dtterm manual pages) and further extended the group of 3220 window controls. 3221 3222 There were two sets of controls (CSI Ps [ ; Pm ; Pm ] t , and OSC Ps 3223 text ST ) implemented by shelltool, documented in appendix E of both 3224 PHIGS Programming Manual (1992), and the unpublished X Window System 3225 User's Guide (OPEN LOOK Edition) (1995). The CDE program kept 3226 those, and added a few new ones. 3227 3228 Code Sun CDE XTerm Description 3229 -----------+-----+-----+-------+--------------------------------- 3230 CSI 1 t | yes | yes | yes | de-iconify 3231 CSI 2 t | yes | yes | yes | iconify 3232 CSI 3 t | yes | yes | yes | move window to pixel-position 3233 CSI 4 t | yes | yes | yes | resize window in pixels 3234 CSI 5 t | yes | yes | yes | raise window to front of stack 3235 CSI 6 t | yes | yes | yes | raise window to back of stack 3236 CSI 7 t | yes | yes | yes | refresh window 3237 CSI 8 t | yes | yes | yes | resize window in chars 3238 CSI 9 t | - | - | yes | maximize/unmaximize window 3239 CSI 1 0 t | - | - | yes | to/from full-screen 3240 CSI 1 1 t | yes | yes | yes | report if window is iconified 3241 CSI 1 2 t | - | - | - | - 3242 CSI 1 3 t | yes | yes | yes | report window position 3243 CSI 1 4 t | yes | yes | yes | report window size in pixels 3244 CSI 1 5 t | - | - | yes | report screen size in pixels 3245 CSI 1 6 t | - | - | yes | report character cell in pixels 3246 CSI 1 7 t | - | - | - | - 3247 CSI 1 8 t | yes | yes | yes | report window size in chars 3248 CSI 1 9 t | - | - | yes | report screen size in chars 3249 CSI 2 0 t | - | yes | yes | report icon label 3250 CSI 2 1 t | - | yes | yes | report window title 3251 CSI 2 2 t | - | - | yes | save window/icon title 3252 CSI 2 3 t | - | - | yes | restore window/icon title 3253 CSI 2 4 t | - | - | yes | resize window (DECSLPP) 3254 OSC 0 ST | - | yes | yes | set window and icon title 3255 OSC 1 ST | - | yes | yes | set icon label 3256 OSC 2 ST | - | yes | yes | set window title 3257 OSC 3 ST | - | n/a | yes | set X server property 3258 OSC I ST | yes | yes | yes | set icon to file 3259 OSC l ST | yes | yes | yes | set window title 3260 OSC L ST | yes | yes | yes | set icon label 3261 -----------+-----+-----+-------+--------------------------------- 3262 3263 Besides the Sun-derived OSC controls for setting window title and 3264 icon label, dtterm also supported the xterm controls for the same 3265 feature. 3266 3267 The CDE source was unavailable for inspection until 2012, so that 3268 clarification of the details of the window operations relied upon 3269 vttest. 3270 3271o The SCOSC/SCORC control sequences for saving/restoring the cursor 3272 and for saving/restoring "DEC Private Mode Values" (XTSAVE and 3273 XTRESTORE) may appear to be related (since the "save" controls both 3274 end with s ), but that is coincidental. The latter was introduced 3275 in X10.4 (December 1986): 3276 3277 Most Dec Private mode settings can be saved away internally 3278 using \E[?ns, where n is the same number to set or reset the Dec 3279 Private mode. The mode can be restored using \E[?nr. This can 3280 be used in termcap for vi, for example, to turn off saving of 3281 lines, but restore whatever the original state was on exit. 3282 3283 while the SCOSC/SCORC pair was added in 1995 by XFree86 (and 3284 documented long afterwards). 3285 3286 The SCO ANSI console terminal descriptions did not use these 3287 controls (they used the VT100-compatible SC/RC pair). SCOSC/SCORC 3288 were an artifact of DOS 2.00 (January 1983), by Microsoft and later 3289 supported by SCO and other vendors. 3290 3291 The SCOSC/SCORC pair is considered a private mode because the final 3292 characters (s and u ) fall in the range from "`" to "~" (octal 0140 3293 to octal 0176). Other private control sequences can be constructed 3294 by using octets 074 to 077 (characters "<", "=", ">", or "?") at the 3295 beginning of the parameter string. The XTSAVE and XTRESTORE 3296 controls use "?") in this manner. 3297 3298 Because the XTSAVE and XTRESTORE controls are private, other 3299 terminals may behave differently. For example, DEC (a contributor 3300 to the early xterm as well as a manufacturer of terminals) used an 3301 incompatible private control in one of its terminals more than five 3302 years later (for the VT420 PCTerm, announced in February 1992). 3303 3304 In that model of the VT420, CSI ? Pm; Pc r selects the PC TERM 3305 emulation mode. When this mode is enabled, the keyboard sends scan 3306 codes rather than characters (analogous to X keyboard events). The 3307 first parameter of this private control enables or disables PC TERM 3308 mode, while the second selects a character set. An ambiguity arises 3309 if an application omits the second parameter. In that special case, 3310 it cannot be distinguished from XTRESTORE. DEC did not take this 3311 into account when designing the feature. 3312 3313 If there were potential users, xterm could accommodate this by a 3314 resource setting. In retrospect (thirty years later), there have 3315 been no uses of PC TERM, while the XTRESTORE feature is still in 3316 use. 3317 3318o The aixterm manual page gives the format of the control sequence for 3319 foreground and background colors 8-15, but does not specify what 3320 those colors are. That is implied by the description's mention of 3321 HFT: 3322 3323 The aixterm command provides a standard terminal type for 3324 programs that do not interact directly with Enhanced X-Windows. 3325 This command provides an emulation for a VT102 terminal or a 3326 high function terminal (HFT). The VT102 mode is activated by 3327 the -v flag. 3328 3329 Unlike xterm, there are no resource names for the 16 colors, leaving 3330 the reader to assume that the mapping is hard-coded. The control 3331 sequences for colors 8-15 are not specified by ECMA-48, but rather 3332 (as done in other instances by xterm) chosen to not conflict with 3333 current or future standards. 3334