ctlseqs.txt revision 2eaa94a1
1 2 3 4 5 6 7 8 9 10 Xterm Control Sequences 11 12 Edward Moy 13 University of California, Berkeley 14 15 Revised by 16 17 Stephen Gildea 18 X Consortium (1994) 19 20 Thomas Dickey 21 XFree86 Project (1996-2006) 22 invisible-island.net (2006-2008) 23 24 25 26Definitions 27 28c The literal character c. 29 30C A single (required) character. 31 32Ps A single (usually optional) numeric parameter, composed of one of 33 more digits. 34 35Pm A multiple numeric parameter composed of any number of single 36 numeric parameters, separated by ; character(s). Individual val- 37 ues for the parameters are listed with Ps . 38 39Pt A text parameter composed of printable characters. 40 41C1 (8-Bit) Control Characters 42 43The xterm program recognizes both 8-bit and 7-bit control characters. 44It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled. 45The following pairs of 7-bit and 8-bit control characters are equiva- 46lent: 47 48ESC D 49 Index (IND is 0x84) 50ESC E 51 Next Line (NEL is 0x85) 52ESC H 53 Tab Set (HTS is 0x88) 54ESC M 55 Reverse Index (RI is 0x8d) 56ESC N 57 Single Shift Select of G2 Character Set (SS2 is 0x8e): affects 58 next character only 59ESC O 60 Single Shift Select of G3 Character Set (SS3 is 0x8f): affects 61 next character only 62ESC P 63 Device Control String (DCS is 0x90) 64ESC V 65 Start of Guarded Area (SPA is 0x96) 66ESC W 67 End of Guarded Area (EPA is 0x97) 68ESC X 69 Start of String (SOS is 0x98) 70ESC Z 71 Return Terminal ID (DECID is 0x9a). Obsolete form of CSI c (DA). 72ESC [ 73 Control Sequence Introducer (CSI is 0x9b) 74ESC \ 75 String Terminator (ST is 0x9c) 76ESC ] 77 Operating System Command (OSC is 0x9d) 78ESC ^ 79 Privacy Message (PM is 0x9e) 80ESC _ 81 Application Program Command (APC is 0x9f) 82 83These control characters are used in the vtXXX emulation. 84 85VT100 Mode 86Most of these control sequences are standard VT102 control sequences, 87but there is support for later DEC VT terminals (i.e., VT220, VT320, 88VT420), as well as ISO 6429 and aixterm color controls. The only VT102 89features not supported is auto-repeat, since the only way X provides for 90this will affect all windows. There are additional control sequences to 91provide xterm-dependent functions, such as the scrollbar or window size. 92Where the function is specified by DEC or ISO 6429, the code assigned to 93it is given in parentheses. The escape codes to designate and invoke 94character sets are specified by ISO 2022; see that document for a dis- 95cussion of character sets. 96 97Single-character functions 98BEL Bell (Ctrl-G) 99BS Backspace (Ctrl-H) 100CR Carriage Return (Ctrl-M) 101ENQ Return Terminal Status (Ctrl-E). Default response is an empty 102 string, but may be overridden by a resource answerbackString. 103FF Form Feed or New Page (NP) (Ctrl-L) same as LF 104LF Line Feed or New Line (NL) (Ctrl-J) 105SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set: 106 invokes the G1 character set. 107SP Space. 108TAB Horizontal Tab (HT) (Ctrl-I) 109VT Vertical Tab (Ctrl-K) same as LF 110SI Shift In (Ctrl-O) -> Switch to Standard Character Set: invokes 111 the G0 character set (the default). 112 113Controls beginning with ESC (other than those where ESC is part of a 1147-bit equivalent to 8-bit C1 controls), ordered by the final charac- 115ter(s). 116ESC SP F 7-bit controls (S7C1T). 117ESC SP G 8-bit controls (S8C1T). 118ESC SP L Set ANSI conformance level 1 (dpANS X3.134.1). 119ESC SP M Set ANSI conformance level 2 (dpANS X3.134.1). 120ESC SP N Set ANSI conformance level 3 (dpANS X3.134.1). 121ESC # 3 DEC double-height line, top half (DECDHL) 122ESC # 4 DEC double-height line, bottom half (DECDHL) 123ESC # 5 DEC single-width line (DECSWL) 124ESC # 6 DEC double-width line (DECDWL) 125ESC # 8 DEC Screen Alignment Test (DECALN) 126ESC % @ Select default character set, ISO 8859-1 (ISO 2022) 127ESC % G Select UTF-8 character set (ISO 2022) 128ESC ( C Designate G0 Character Set (ISO 2022) 129ESC ) C Designate G1 Character Set (ISO 2022) 130ESC * C Designate G2 Character Set (ISO 2022) 131ESC + C Designate G3 Character Set (ISO 2022) 132 Final character C for designating 94-character sets (0 , A 133 and B apply to VT100 and up, the remainder to VT220 and up): 134 C = 0 -> DEC Special Character and Line Drawing Set 135 C = A -> United Kingdom (UK) 136 C = B -> United States (USASCII) 137 C = 4 -> Dutch 138 C = C or 5 -> Finnish 139 C = R -> French 140 C = Q -> French Canadian 141 C = K -> German 142 C = Y -> Italian 143 C = E or 6 -> Norwegian/Danish 144 C = Z -> Spanish 145 C = H or 7 -> Swedish 146 C = = -> Swiss 147ESC - C Designate G1 Character Set (VT300) 148ESC . C Designate G2 Character Set (VT300) 149ESC / C Designate G3 Character Set (VT300) 150 These work for 96-character sets only. 151 C = A -> ISO Latin-1 Supplemental 152ESC 7 Save Cursor (DECSC) 153ESC 8 Restore Cursor (DECRC) 154ESC = Application Keypad (DECPAM) 155ESC > Normal Keypad (DECPNM) 156ESC F Cursor to lower left corner of screen (if enabled by the 157 hpLowerleftBugCompat resource). 158ESC c Full Reset (RIS) 159ESC l Memory Lock (per HP terminals). Locks memory above the cur- 160 sor. 161ESC m Memory Unlock (per HP terminals) 162ESC n Invoke the G2 Character Set as GL (LS2). 163ESC o Invoke the G3 Character Set as GL (LS3). 164ESC | Invoke the G3 Character Set as GR (LS3R). 165ESC } Invoke the G2 Character Set as GR (LS2R). 166ESC ~ Invoke the G1 Character Set as GR (LS1R). 167 168Application Program-Control functions 169APC Pt ST xterm implements no APC functions; Pt is ignored. Pt need 170 not be printable characters. 171 172Device-Control functions 173DCS Ps; Ps| Pt ST 174 User-Defined Keys (DECUDK). The first parameter: 175 Ps = 0 -> Clear all UDK definitions before starting 176 (default) 177 Ps = 1 -> Erase Below (default) 178 The second parameter: 179 Ps = 0 -> Lock the keys (default) 180 Ps = 1 -> Do not lock. 181 The third parameter is a ';'-separated list of strings denot- 182 ing the key-code separated by a '/' from the hex-encoded key 183 value. The key codes correspond to the DEC function-key codes 184 (e.g., F6=17). 185DCS $ q Pt ST 186 Request Status String (DECRQSS). The string following the "q" 187 is one of the following: 188 " q -> DECSCA 189 " p -> DECSCL 190 r -> DECSTBM 191 m -> SGR 192 xterm responds with DCS 1 $ r Pt ST for valid requests, 193 replacing the Pt with the corresponding CSI string, or DCS 0 $ 194 r Pt ST for invalid requests. 195DCS + q Pt ST 196 Request Termcap/Terminfo String (xterm, experimental). The 197 string following the "q" is a list of names encoded in hex- 198 adecimal (2 digits per character) separated by ; which corre- 199 spond to termcap or terminfo key names. 200 xterm responds with DCS 1 + r Pt ST for valid requests, adding 201 to Pt an = , and the value of the corresponding string that 202 xterm would send, or DCS 0 + r Pt ST for invalid requests. 203 The strings are encoded in hexadecimal (2 digits per charac- 204 ter). 205 206Functions using CSI , ordered by the final character(s) 207CSI Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH) 208CSI Ps A Cursor Up Ps Times (default = 1) (CUU) 209CSI Ps B Cursor Down Ps Times (default = 1) (CUD) 210CSI Ps C Cursor Forward Ps Times (default = 1) (CUF) 211CSI Ps D Cursor Backward Ps Times (default = 1) (CUB) 212CSI Ps E Cursor Next Line Ps Times (default = 1) (CNL) 213CSI Ps F Cursor Preceding Line Ps Times (default = 1) (CPL) 214CSI Ps G Cursor Character Absolute [column] (default = [row,1]) (CHA) 215CSI Ps ; Ps H 216 Cursor Position [row;column] (default = [1,1]) (CUP) 217CSI Ps I Cursor Forward Tabulation Ps tab stops (default = 1) (CHT) 218CSI Ps J Erase in Display (ED) 219 Ps = 0 -> Erase Below (default) 220 Ps = 1 -> Erase Above 221 Ps = 2 -> Erase All 222 Ps = 3 -> Erase Saved Lines (xterm) 223CSI ? Ps J 224 Erase in Display (DECSED) 225 Ps = 0 -> Selective Erase Below (default) 226 Ps = 1 -> Selective Erase Above 227 Ps = 2 -> Selective Erase All 228CSI Ps K Erase in Line (EL) 229 Ps = 0 -> Erase to Right (default) 230 Ps = 1 -> Erase to Left 231 Ps = 2 -> Erase All 232CSI ? Ps K 233 Erase in Line (DECSEL) 234 Ps = 0 -> Selective Erase to Right (default) 235 Ps = 1 -> Selective Erase to Left 236 Ps = 2 -> Selective Erase All 237CSI Ps L Insert Ps Line(s) (default = 1) (IL) 238CSI Ps M Delete Ps Line(s) (default = 1) (DL) 239CSI Ps P Delete Ps Character(s) (default = 1) (DCH) 240CSI Ps S Scroll up Ps lines (default = 1) (SU) 241CSI Ps T Scroll down Ps lines (default = 1) (SD) 242CSI Ps ; Ps ; Ps ; Ps ; Ps T 243 Initiate highlight mouse tracking. Parameters are 244 [func;startx;starty;firstrow;lastrow]. See the section Mouse 245 Tracking. 246CSI Ps X Erase Ps Character(s) (default = 1) (ECH) 247CSI Ps Z Cursor Backward Tabulation Ps tab stops (default = 1) (CBT) 248CSI Pm ` Character Position Absolute [column] (default = [row,1]) 249 (HPA) 250CSI Ps b Repeat the preceding graphic character Ps times (REP) 251CSI Ps c Send Device Attributes (Primary DA) 252 Ps = 0 or omitted -> request attributes from terminal. The 253 response depends on the decTerminalID resource setting. 254 -> CSI ? 1 ; 2 c (``VT100 with Advanced Video Option'') 255 -> CSI ? 1 ; 0 c (``VT101 with No Options'') 256 -> CSI ? 6 c (``VT102'') 257 -> CSI ? 6 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c (``VT220'') 258 The VT100-style response parameters do not mean anything by 259 themselves. VT220 parameters do, telling the host what fea- 260 tures the terminal supports: 261 -> 1 132-columns 262 -> 2 Printer 263 -> 6 Selective erase 264 -> 8 User-defined keys 265 -> 9 National replacement character sets 266 -> 1 5 Technical characters 267 -> 2 2 ANSI color, e.g., VT525 268 -> 2 9 ANSI text locator (i.e., DEC Locator mode) 269CSI > Ps c 270 Send Device Attributes (Secondary DA) 271 Ps = 0 or omitted -> request the terminal's identification 272 code. The response depends on the decTerminalID resource set- 273 ting. It should apply only to VT220 and up, but xterm extends 274 this to VT100. 275 -> CSI > Pp ; Pv ; Pc c 276 where Pp denotes the terminal type 277 -> 0 (``VT100'') 278 -> 1 (``VT220'') 279 and Pv is the firmware version (for xterm, this was originally 280 the XFree86 patch number, starting with 95). In a DEC termi- 281 nal, Pc indicates the ROM cartridge registration number and is 282 always zero. 283CSI Pm d Line Position Absolute [row] (default = [1,column]) (VPA) 284CSI Ps ; Ps f 285 Horizontal and Vertical Position [row;column] (default = 286 [1,1]) (HVP) 287CSI Ps g Tab Clear (TBC) 288 Ps = 0 -> Clear Current Column (default) 289 Ps = 3 -> Clear All 290CSI Pm h Set Mode (SM) 291 Ps = 2 -> Keyboard Action Mode (AM) 292 Ps = 4 -> Insert Mode (IRM) 293 Ps = 1 2 -> Send/receive (SRM) 294 Ps = 2 0 -> Automatic Newline (LNM) 295CSI ? Pm h 296 DEC Private Mode Set (DECSET) 297 Ps = 1 -> Application Cursor Keys (DECCKM) 298 Ps = 2 -> Designate USASCII for character sets G0-G3 299 (DECANM), and set VT100 mode. 300 Ps = 3 -> 132 Column Mode (DECCOLM) 301 Ps = 4 -> Smooth (Slow) Scroll (DECSCLM) 302 Ps = 5 -> Reverse Video (DECSCNM) 303 Ps = 6 -> Origin Mode (DECOM) 304 Ps = 7 -> Wraparound Mode (DECAWM) 305 Ps = 8 -> Auto-repeat Keys (DECARM) 306 Ps = 9 -> Send Mouse X & Y on button press. See the sec- 307 tion Mouse Tracking. 308 Ps = 1 0 -> Show toolbar (rxvt) 309 Ps = 1 2 -> Start Blinking Cursor (att610) 310 Ps = 1 8 -> Print form feed (DECPFF) 311 Ps = 1 9 -> Set print extent to full screen (DECPEX) 312 Ps = 2 5 -> Show Cursor (DECTCEM) 313 Ps = 3 0 -> Show scrollbar (rxvt). 314 Ps = 3 5 -> Enable font-shifting functions (rxvt). 315 Ps = 3 8 -> Enter Tektronix Mode (DECTEK) 316 Ps = 4 0 -> Allow 80 -> 132 Mode 317 Ps = 4 1 -> more(1) fix (see curses resource) 318 Ps = 4 2 -> Enable Nation Replacement Character sets (DECN- 319 RCM) 320 Ps = 4 4 -> Turn On Margin Bell 321 Ps = 4 5 -> Reverse-wraparound Mode 322 Ps = 4 6 -> Start Logging (normally disabled by a compile- 323 time option) 324 Ps = 4 7 -> Use Alternate Screen Buffer (unless disabled by 325 the titeInhibit resource) 326 Ps = 6 6 -> Application keypad (DECNKM) 327 Ps = 6 7 -> Backarrow key sends backspace (DECBKM) 328 Ps = 1 0 0 0 -> Send Mouse X & Y on button press and 329 release. See the section Mouse Tracking. 330 Ps = 1 0 0 1 -> Use Hilite Mouse Tracking. 331 Ps = 1 0 0 2 -> Use Cell Motion Mouse Tracking. 332 Ps = 1 0 0 3 -> Use All Motion Mouse Tracking. 333 Ps = 1 0 0 4 -> Send FocusIn/FocusOut events. 334 Ps = 1 0 1 0 -> Scroll to bottom on tty output (rxvt). 335 Ps = 1 0 1 1 -> Scroll to bottom on key press (rxvt). 336 Ps = 1 0 3 4 -> Interpret "meta" key, sets eighth bit. 337 (enables the eightBitInput resource). 338 Ps = 1 0 3 5 -> Enable special modifiers for Alt and Num- 339 Lock keys (enables the numLock resource). 340 Ps = 1 0 3 6 -> Send ESC when Meta modifies a key (enables 341 the metaSendsEscape resource). 342 Ps = 1 0 3 7 -> Send DEL from the editing-keypad Delete key 343 Ps = 1 0 3 9 -> Send ESC when Alt modifies a key (enables 344 the altSendsEscape resource). 345 Ps = 1 0 4 0 -> Keep selection even if not highlighted 346 (enables the keepSelection resource). 347 Ps = 1 0 4 1 -> Use the CLIPBOARD selection (enables the 348 selectToClipboard resource). 349 Ps = 1 0 4 2 -> Enable Urgency window manager hint when 350 Control-G is received (enables the bellIsUrgent resource). 351 Ps = 1 0 4 3 -> Enable raising of the window when Control-G 352 is received (enables the popOnBell resource). 353 Ps = 1 0 4 7 -> Use Alternate Screen Buffer (unless dis- 354 abled by the titeInhibit resource) 355 Ps = 1 0 4 8 -> Save cursor as in DECSC (unless disabled by 356 the titeInhibit resource) 357 Ps = 1 0 4 9 -> Save cursor as in DECSC and use Alternate 358 Screen Buffer, clearing it first (unless disabled by the 359 titeInhibit resource). This combines the effects of the 1 0 4 360 7 and 1 0 4 8 modes. Use this with terminfo-based applica- 361 tions rather than the 4 7 mode. 362 Ps = 1 0 5 0 -> Set terminfo/termcap function-key mode. 363 Ps = 1 0 5 1 -> Set Sun function-key mode. 364 Ps = 1 0 5 2 -> Set HP function-key mode. 365 Ps = 1 0 5 3 -> Set SCO function-key mode. 366 Ps = 1 0 6 0 -> Set legacy keyboard emulation (X11R6). 367 Ps = 1 0 6 1 -> Set VT220 keyboard emulation. 368 Ps = 2 0 0 4 -> Set bracketed paste mode. 369CSI Pm i Media Copy (MC) 370 Ps = 0 -> Print screen (default) 371 Ps = 4 -> Turn off printer controller mode 372 Ps = 5 -> Turn on printer controller mode 373CSI ? Pm i 374 Media Copy (MC, DEC-specific) 375 Ps = 1 -> Print line containing cursor 376 Ps = 4 -> Turn off autoprint mode 377 Ps = 5 -> Turn on autoprint mode 378 Ps = 1 0 -> Print composed display, ignores DECPEX 379 Ps = 1 1 -> Print all pages 380CSI Pm l Reset Mode (RM) 381 Ps = 2 -> Keyboard Action Mode (AM) 382 Ps = 4 -> Replace Mode (IRM) 383 Ps = 1 2 -> Send/receive (SRM) 384 Ps = 2 0 -> Normal Linefeed (LNM) 385CSI ? Pm l 386 DEC Private Mode Reset (DECRST) 387 Ps = 1 -> Normal Cursor Keys (DECCKM) 388 Ps = 2 -> Designate VT52 mode (DECANM). 389 Ps = 3 -> 80 Column Mode (DECCOLM) 390 Ps = 4 -> Jump (Fast) Scroll (DECSCLM) 391 Ps = 5 -> Normal Video (DECSCNM) 392 Ps = 6 -> Normal Cursor Mode (DECOM) 393 Ps = 7 -> No Wraparound Mode (DECAWM) 394 Ps = 8 -> No Auto-repeat Keys (DECARM) 395 Ps = 9 -> Don't send Mouse X & Y on button press 396 Ps = 1 0 -> Hide toolbar (rxvt) 397 Ps = 1 2 -> Stop Blinking Cursor (att610) 398 Ps = 1 8 -> Don't print form feed (DECPFF) 399 Ps = 1 9 -> Limit print to scrolling region (DECPEX) 400 Ps = 2 5 -> Hide Cursor (DECTCEM) 401 Ps = 3 0 -> Don't show scrollbar (rxvt). 402 Ps = 3 5 -> Disable font-shifting functions (rxvt). 403 Ps = 4 0 -> Disallow 80 -> 132 Mode 404 Ps = 4 1 -> No more(1) fix (see curses resource) 405 Ps = 4 2 -> Disable Nation Replacement Character sets (DEC- 406 NRCM) 407 Ps = 4 4 -> Turn Off Margin Bell 408 Ps = 4 5 -> No Reverse-wraparound Mode 409 Ps = 4 6 -> Stop Logging (normally disabled by a compile- 410 time option) 411 Ps = 4 7 -> Use Normal Screen Buffer 412 Ps = 6 6 -> Numeric keypad (DECNKM) 413 Ps = 6 7 -> Backarrow key sends delete (DECBKM) 414 Ps = 1 0 0 0 -> Don't send Mouse X & Y on button press and 415 release. See the section Mouse Tracking. 416 Ps = 1 0 0 1 -> Don't use Hilite Mouse Tracking. 417 Ps = 1 0 0 2 -> Don't use Cell Motion Mouse Tracking. 418 Ps = 1 0 0 3 -> Don't use All Motion Mouse Tracking. 419 Ps = 1 0 0 4 -> Don't send FocusIn/FocusOut events. 420 Ps = 1 0 1 0 -> Don't scroll to bottom on tty output 421 (rxvt). 422 Ps = 1 0 1 1 -> Don't scroll to bottom on key press (rxvt). 423 Ps = 1 0 3 4 -> Don't interpret "meta" key (disables the 424 eightBitInput resource). 425 Ps = 1 0 3 5 -> Disable special modifiers for Alt and Num- 426 Lock keys (disables the numLock resource). 427 Ps = 1 0 3 6 -> Don't send ESC when Meta modifies a key 428 (disables the metaSendsEscape resource). 429 Ps = 1 0 3 7 -> Send VT220 Remove from the editing-keypad 430 Delete key 431 Ps = 1 0 3 9 -> Don't send ESC when Alt modifies a key 432 (disables the altSendsEscape resource). 433 Ps = 1 0 4 0 -> Do not keep selection when not highlighted 434 (disables the keepSelection resource). 435 Ps = 1 0 4 1 -> Use the PRIMARY selection. (disables the 436 selectToClipboard resource). 437 Ps = 1 0 4 2 -> Disable Urgency window manager hint when 438 Control-G is received (disables the bellIsUrgent resource). 439 Ps = 1 0 4 3 -> Disable raising of the window when Control- 440 G is received (disables the popOnBell resource). 441 Ps = 1 0 4 7 -> Use Normal Screen Buffer, clearing screen 442 first if in the Alternate Screen (unless disabled by the 443 titeInhibit resource) 444 Ps = 1 0 4 8 -> Restore cursor as in DECRC (unless disabled 445 by the titeInhibit resource) 446 Ps = 1 0 4 9 -> Use Normal Screen Buffer and restore cursor 447 as in DECRC (unless disabled by the titeInhibit resource). 448 This combines the effects of the 1 0 4 7 and 1 0 4 8 modes. 449 Use this with terminfo-based applications rather than the 4 7 450 mode. 451 Ps = 1 0 5 0 -> Reset terminfo/termcap function-key mode. 452 Ps = 1 0 5 1 -> Reset Sun function-key mode. 453 Ps = 1 0 5 2 -> Reset HP function-key mode. 454 Ps = 1 0 5 3 -> Reset SCO function-key mode. 455 Ps = 1 0 6 0 -> Reset legacy keyboard emulation (X11R6). 456 Ps = 1 0 6 1 -> Reset keyboard emulation to Sun/PC style. 457 Ps = 2 0 0 4 -> Reset bracketed paste mode. 458CSI Pm m Character Attributes (SGR) 459 Ps = 0 -> Normal (default) 460 Ps = 1 -> Bold 461 Ps = 4 -> Underlined 462 Ps = 5 -> Blink (appears as Bold) 463 Ps = 7 -> Inverse 464 Ps = 8 -> Invisible, i.e., hidden (VT300) 465 Ps = 2 2 -> Normal (neither bold nor faint) 466 Ps = 2 4 -> Not underlined 467 Ps = 2 5 -> Steady (not blinking) 468 Ps = 2 7 -> Positive (not inverse) 469 Ps = 2 8 -> Visible, i.e., not hidden (VT300) 470 Ps = 3 0 -> Set foreground color to Black 471 Ps = 3 1 -> Set foreground color to Red 472 Ps = 3 2 -> Set foreground color to Green 473 Ps = 3 3 -> Set foreground color to Yellow 474 Ps = 3 4 -> Set foreground color to Blue 475 Ps = 3 5 -> Set foreground color to Magenta 476 Ps = 3 6 -> Set foreground color to Cyan 477 Ps = 3 7 -> Set foreground color to White 478 Ps = 3 9 -> Set foreground color to default (original) 479 Ps = 4 0 -> Set background color to Black 480 Ps = 4 1 -> Set background color to Red 481 Ps = 4 2 -> Set background color to Green 482 Ps = 4 3 -> Set background color to Yellow 483 Ps = 4 4 -> Set background color to Blue 484 Ps = 4 5 -> Set background color to Magenta 485 Ps = 4 6 -> Set background color to Cyan 486 Ps = 4 7 -> Set background color to White 487 Ps = 4 9 -> Set background color to default (original). 488 489 If 16-color support is compiled, the following apply. Assume 490 that xterm's resources are set so that the ISO color codes are 491 the first 8 of a set of 16. Then the aixterm colors are the 492 bright versions of the ISO colors: 493 Ps = 9 0 -> Set foreground color to Black 494 Ps = 9 1 -> Set foreground color to Red 495 Ps = 9 2 -> Set foreground color to Green 496 Ps = 9 3 -> Set foreground color to Yellow 497 Ps = 9 4 -> Set foreground color to Blue 498 Ps = 9 5 -> Set foreground color to Magenta 499 Ps = 9 6 -> Set foreground color to Cyan 500 Ps = 9 7 -> Set foreground color to White 501 Ps = 1 0 0 -> Set background color to Black 502 Ps = 1 0 1 -> Set background color to Red 503 Ps = 1 0 2 -> Set background color to Green 504 Ps = 1 0 3 -> Set background color to Yellow 505 Ps = 1 0 4 -> Set background color to Blue 506 Ps = 1 0 5 -> Set background color to Magenta 507 Ps = 1 0 6 -> Set background color to Cyan 508 Ps = 1 0 7 -> Set background color to White 509 510 If xterm is compiled with the 16-color support disabled, it 511 supports the following, from rxvt: 512 Ps = 1 0 0 -> Set foreground and background color to 513 default 514 515 If 88- or 256-color support is compiled, the following apply. 516 Ps = 3 8 ; 5 ; Ps -> Set foreground color to the second Ps 517 Ps = 4 8 ; 5 ; Ps -> Set background color to the second Ps 518 519CSI > Ps; Ps m 520 Set or reset resource-values used by xterm to decide whether 521 to construct escape sequences holding information about the 522 modifiers pressed with a given key. The first parameter iden- 523 tifies the resource to set/reset. The second parameter is the 524 value to assign to the resource. If the second parameter is 525 omitted, the resource is reset to its initial value. 526 -> 1 modifyCursorKeys 527 -> 2 modifyFunctionKeys 528 -> 4 modifyOtherKeys 529 If no parameters are given, all resources are reset to their 530 initial values. 531CSI Ps n Device Status Report (DSR) 532 Ps = 5 -> Status Report CSI 0 n (``OK'') 533 Ps = 6 -> Report Cursor Position (CPR) [row;column] as 534 CSI r ; c R 535CSI > Ps n 536 Disable modifiers which may be enabled via the CSI > Ps; Ps m 537 sequence. This corresponds to a resource value of "-1", which 538 cannot be set with the other sequence. The parameter identi- 539 fies the resource to be disabled: 540 -> 1 modifyCursorKeys 541 -> 2 modifyFunctionKeys 542 -> 4 modifyOtherKeys If the parameter is omitted, modify- 543 FunctionKeys is disabled. When modifyFunctionKeys is dis- 544 abled, xterm uses the modifier keys to make an extended 545 sequence of functions rather than adding a parameter to each 546 function key to denote the modifiers. 547CSI ? Ps n 548 Device Status Report (DSR, DEC-specific) 549 Ps = 6 -> Report Cursor Position (CPR) [row;column] as CSI 550 ? r ; c R (assumes page is zero). 551 Ps = 1 5 -> Report Printer status as CSI ? 1 0 n (ready) 552 or CSI ? 1 1 n (not ready) 553 Ps = 2 5 -> Report UDK status as CSI ? 2 0 n (unlocked) 554 or CSI ? 2 1 n (locked) 555 Ps = 2 6 -> Report Keyboard status as 556 CSI ? 2 7 ; 1 ; 0 ; 0 n (North American) 557 The last two parameters apply to VT400 & up, and denote key- 558 board ready and LK01 respectively. 559 Ps = 5 3 -> Report Locator status as 560 CSI ? 5 3 n Locator available, if compiled-in, or 561 CSI ? 5 0 n No Locator, if not. 562CSI > Ps p 563 Set resource value pointerMode, used by xterm to decide 564 whether to hide the pointer cursor as the user types. Valid 565 values for the parameter: 566 Ps = 0 -> never hide the pointer 567 Ps = 1 -> hide if the mouse tracking mode is not enabled 568 Ps = 2 -> always hide the pointer If no parameter is given, 569 xterm uses the default, which is 1 . 570CSI ! p Soft terminal reset (DECSTR) 571CSI Ps ; Ps " p 572 Set conformance level (DECSCL) Valid values for the first 573 parameter: 574 Ps = 6 1 -> VT100 575 Ps = 6 2 -> VT200 576 Ps = 6 3 -> VT300 577 Valid values for the second parameter: 578 Ps = 0 -> 8-bit controls 579 Ps = 1 -> 7-bit controls (always set for VT100) 580 Ps = 2 -> 8-bit controls 581CSI Ps " q 582 Select character protection attribute (DECSCA). Valid values 583 for the parameter: 584 Ps = 0 -> DECSED and DECSEL can erase (default) 585 Ps = 1 -> DECSED and DECSEL cannot erase 586 Ps = 2 -> DECSED and DECSEL can erase 587CSI Ps ; Ps r 588 Set Scrolling Region [top;bottom] (default = full size of win- 589 dow) (DECSTBM) 590CSI ? Pm r 591 Restore DEC Private Mode Values. The value of Ps previously 592 saved is restored. Ps values are the same as for DECSET. 593CSI Pt; Pl; Pb; Pr; Ps$ r 594 Change Attributes in Rectangular Area (DECCARA). 595 Pt; Pl; Pb; Pr denotes the rectangle. 596 Ps denotes the SGR attributes to change: 0, 1, 4, 5, 7 597CSI s Save cursor (ANSI.SYS) 598CSI ? Pm s 599 Save DEC Private Mode Values. Ps values are the same as for 600 DECSET. 601CSI Ps ; Ps ; Ps t 602 Window manipulation (from dtterm, as well as extensions). 603 These controls may be disabled using the allowWindowOps 604 resource. Valid values for the first (and any additional 605 parameters) are: 606 Ps = 1 -> De-iconify window. 607 Ps = 2 -> Iconify window. 608 Ps = 3 ; x ; y -> Move window to [x, y]. 609 Ps = 4 ; height ; width -> Resize the xterm window to 610 height and width in pixels. 611 Ps = 5 -> Raise the xterm window to the front of the stack- 612 ing order. 613 Ps = 6 -> Lower the xterm window to the bottom of the 614 stacking order. 615 Ps = 7 -> Refresh the xterm window. 616 Ps = 8 ; height ; width -> Resize the text area to 617 [height;width] in characters. 618 Ps = 9 ; 0 -> Restore maximized window. 619 Ps = 9 ; 1 -> Maximize window (i.e., resize to screen 620 size). 621 Ps = 1 1 -> Report xterm window state. If the xterm window 622 is open (non-iconified), it returns CSI 1 t . If the xterm 623 window is iconified, it returns CSI 2 t . 624 Ps = 1 3 -> Report xterm window position as CSI 3 ; x; yt 625 Ps = 1 4 -> Report xterm window in pixels as CSI 4 ; 626 height ; width t 627 Ps = 1 8 -> Report the size of the text area in characters 628 as CSI 8 ; height ; width t 629 Ps = 1 9 -> Report the size of the screen in characters as 630 CSI 9 ; height ; width t 631 Ps = 2 0 -> Report xterm window's icon label as OSC L 632 label ST 633 Ps = 2 1 -> Report xterm window's title as OSC l title ST 634 Ps >= 2 4 -> Resize to Ps lines (DECSLPP) 635CSI Pt; Pl; Pb; Pr; Ps$ t 636 Reverse Attributes in Rectangular Area (DECRARA). 637 Pt; Pl; Pb; Pr denotes the rectangle. 638 Ps denotes the attributes to reverse. 1, 4, 5, 7 639CSI u Save cursor (ANSI.SYS) 640CSI Pt; Pl; Pb; Pr; Pp; Pt; Pl; Pp$ v 641 Copy Rectangular Area (DECCRA) 642 Pt; Pl; Pb; Pr denotes the rectangle. 643 Pp denotes the source page. 644 Pt; Pl denotes the target location. 645 Pp denotes the target page. 646CSI Pt ; Pl ; Pb ; Pr ' w 647 Enable Filter Rectangle (DECEFR) 648 Parameters are [top;left;bottom;right]. 649 Defines the coordinates of a filter rectangle and activates 650 it. Anytime the locator is detected outside of the filter 651 rectangle, an outside rectangle event is generated and the 652 rectangle is disabled. Filter rectangles are always treated 653 as "one-shot" events. Any parameters that are omitted default 654 to the current locator position. If all parameters are omit- 655 ted, any locator motion will be reported. DECELR always can- 656 cels any prevous rectangle definition. 657CSI Ps x Request Terminal Parameters (DECREQTPARM) 658 if Ps is a "0" (default) or "1", and xterm is emulating VT100, 659 the control sequence elicits a response of the same form whose 660 parameters describe the terminal: 661 Ps -> the given Ps incremented by 2. 662 1 -> no parity 663 1 -> eight bits 664 1 2 8 -> transmit 38.4k baud 665 1 2 8 -> receive 38.4k baud 666 1 -> clock multiplier 667 0 -> STP flags 668CSI Ps x Select Attribute Change Extent (DECSACE). 669 Ps = 0 -> from start to end position, wrapped 670 Ps = 1 -> from start to end position, wrapped 671 Ps = 2 -> rectangle (exact). 672CSI Pc; Pt; Pl; Pb; Pr$ x 673 Fill Rectangular Area (DECFRA). 674 Pc is the character to use. 675 Pt; Pl; Pb; Pr denotes the rectangle. 676CSI Ps ; Pu ' z 677 Enable Locator Reporting (DECELR) 678 Valid values for the first parameter: 679 Ps = 0 -> Locator disabled (default) 680 Ps = 1 -> Locator enabled 681 Ps = 2 -> Locator enabled for one report, then disabled 682 The second parameter specifies the coordinate unit for locator 683 reports. 684 Valid values for the second parameter: 685 Pu = 0 or omitted -> default to character cells 686 Pu = 1 -> device physical pixels 687 Pu = 2 -> character cells 688CSI Pt; Pl; Pb; Pr$ z 689 Erase Rectangular Area (DECERA). 690 Pt; Pl; Pb; Pr denotes the rectangle. 691CSI Pm ' { 692 Select Locator Events (DECSLE) 693 Valid values for the first (and any additional parameters) 694 are: 695 Ps = 0 -> only respond to explicit host requests (DECRQLP) 696 (default) also cancels any filter rectangle 697 Ps = 1 -> report button down transitions 698 Ps = 2 -> do not report button down transitions 699 Ps = 3 -> report button up transitions 700 Ps = 4 -> do not report button up transitions 701CSI Pt; Pl; Pb; Pr$ { 702 Selective Erase Rectangular Area (DECSERA). 703 Pt; Pl; Pb; Pr denotes the rectangle. 704CSI Ps ' | 705 Request Locator Position (DECRQLP) 706 Valid values for the parameter are: 707 Ps = 0 , 1 or omitted -> transmit a single DECLRP locator 708 report 709 710 If Locator Reporting has been enabled by a DECELR, xterm will 711 respond with a DECLRP Locator Report. This report is also 712 generated on button up and down events if they have been 713 enabled with a DECSLE, or when the locator is detected outside 714 of a filter rectangle, if filter rectangles have been enabled 715 with a DECEFR. 716 717 -> CSI Pe ; Pb ; Pr ; Pc ; Pp & w 718 719 Parameters are [event;button;row;column;page]. 720 Valid values for the event: 721 Pe = 0 -> locator unavailable - no other parameters sent 722 Pe = 1 -> request - xterm received a DECRQLP 723 Pe = 2 -> left button down 724 Pe = 3 -> left button up 725 Pe = 4 -> middle button down 726 Pe = 5 -> middle button up 727 Pe = 6 -> right button down 728 Pe = 7 -> right button up 729 Pe = 8 -> M4 button down 730 Pe = 9 -> M4 button up 731 Pe = 1 0 -> locator outside filter rectangle 732 ``button'' parameter is a bitmask indicating which buttons are 733 pressed: 734 Pb = 0 -> no buttons down 735 Pb & 1 -> right button down 736 Pb & 2 -> middle button down 737 Pb & 4 -> left button down 738 Pb & 8 -> M4 button down 739 ``row'' and ``column'' parameters are the coordinates of the 740 locator position in the xterm window, encoded as ASCII deci- 741 mal. 742 The ``page'' parameter is not used by xterm, and will be omit- 743 ted. 744 745Operating System Controls 746OSC Ps ; Pt ST 747OSC Ps ; Pt BEL 748 Set Text Parameters. For colors and font, if Pt is a "?", the 749 control sequence elicits a response which consists of the con- 750 trol sequence which would set the corresponding value. The 751 dtterm control sequences allow you to determine the icon name 752 and window title. 753 Ps = 0 -> Change Icon Name and Window Title to Pt 754 Ps = 1 -> Change Icon Name to Pt 755 Ps = 2 -> Change Window Title to Pt 756 Ps = 3 -> Set X property on top-level window. Pt should be 757 in the form "prop=value", or just "prop" to delete the prop- 758 erty 759 Ps = 4 ; c ; spec -> Change Color Number c to the color 760 specified by spec, i.e., a name or RGB specification as per 761 XParseColor. Any number of c name pairs may be given. The 762 color numbers correspond to the ANSI colors 0-7, their bright 763 versions 8-15, and if supported, the remainder of the 88-color 764 or 256-color table. 765 766 If a "?" is given rather than a name or RGB specification, 767 xterm replies with a control sequence of the same form which 768 can be used to set the corresponding color. Because more than 769 one pair of color number and specification can be given in one 770 control sequence, xterm can make more than one reply. 771 772 The 8 colors which may be set using 1 0 through 1 7 are 773 denoted dynamic colors, since the corresponding control 774 sequences were the first means for setting xterm's colors 775 dynamically, i.e., after it was started. They are not the 776 same as the ANSI colors. One or more parameters is expected 777 for Pt. Each successive parameter changes the next color in 778 the list. The value of Ps tells the starting point in the 779 list. The colors are specified by name or RGB specification 780 as per XParseColor. 781 782 If a "?" is given rather than a name or RGB specification, 783 xterm replies with a control sequence of the same form which 784 can be used to set the corresponding dynamic color. Because 785 more than one pair of color number and specification can be 786 given in one control sequence, xterm can make more than one 787 reply. 788 789 Ps = 1 0 -> Change VT100 text foreground color to Pt 790 Ps = 1 1 -> Change VT100 text background color to Pt 791 Ps = 1 2 -> Change text cursor color to Pt 792 Ps = 1 3 -> Change mouse foreground color to Pt 793 Ps = 1 4 -> Change mouse background color to Pt 794 Ps = 1 5 -> Change Tektronix foreground color to Pt 795 Ps = 1 6 -> Change Tektronix background color to Pt 796 Ps = 1 7 -> Change highlight color to Pt 797 Ps = 1 8 -> Change Tektronix cursor color to Pt 798 799 Ps = 4 6 -> Change Log File to Pt (normally disabled by a 800 compile-time option) 801 802 Ps = 5 0 -> Set Font to Pt If Pt begins with a "#", index 803 in the font menu, relative (if the next character is a plus or 804 minus sign) or absolute. A number is expected but not 805 required after the sign (the default is the current entry for 806 relative, zero for absolute indexing). 807 808 Ps = 5 1 (reserved for Emacs shell) 809 810 Ps = 5 2 -> Manipulate Selection Data. These controls may 811 be disabled using the allowWindowOps resource. The parameter 812 Pt is parsed as 813 Pc; Pd 814 The first, Pc, may contain any character from the set c p s 815 0 1 2 3 4 5 6 7 . It is used to construct a list of 816 selection parameters for clipboard, primary, select, or cut 817 buffers 0 through 8 respectively, in the order given. If the 818 parameter is empty, xterm uses s 0 , to specify the config- 819 urable primary/clipboard selection and cut buffer 0. 820 The second parameter, Pd, gives the selection data. Normally 821 this is a string encoded in base64. The data becomes the new 822 selection, which is then available for pasting by other appli- 823 cations. 824 If the second parameter is a ? , xterm replies to the host 825 with the selection data encoded using the same protocol. 826 827Privacy Message 828PM Pt ST xterm implements no PM functions; Pt is ignored. Pt need not 829 be printable characters. 830 831Alt and Meta Keys 832Many keyboards have keys labeled "Alt". Few have keys labeled "Meta". 833However, xterm's default translations use the Meta modifier. Common 834keyboard configurations assign the Meta modifier to an "Alt" key. By 835using xmodmap one may have the modifier assigned to a different key, and 836have "real" alt and meta keys. Here is an example: 837 838 ! put meta on mod3 to distinguish it from alt 839 keycode 64 = Alt_L 840 clear mod1 841 add mod1 = Alt_L 842 keycode 115 = Meta_L 843 clear mod3 844 add mod3 = Meta_L 845 846The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set) 847can be used to control the way the Meta modifier applies to ordinary 848keys unless the modifyOtherKeys resource is set: 849 - prefix a key with the ESC character. 850 - shift the key from codes 0-127 to 128-255 by adding 128. 851The table shows the result for a given character "x" with modifiers 852according to the default translations with the resources set on or off. 853This assumes altIsNotMeta is set: 854 855 ----------------------------------------------------------- 856 key altSendsEscape metaSendsEscape result 857 ----------------------------------------------------------- 858 x off off x 859 Meta-x off off shift 860 Alt-x off off shift 861 Alt+Meta-x off off shift 862 x ON off x 863 Meta-x ON off shift 864 Alt-x ON off ESC x 865 Alt+Meta-x ON off ESC shift 866 x off ON x 867 Meta-x off ON ESC x 868 Alt-x off ON shift 869 Alt+Meta-x off ON ESC shift 870 x ON ON x 871 Meta-x ON ON ESC x 872 Alt-x ON ON ESC x 873 Alt+Meta-x ON ON ESC x 874 ----------------------------------------------------------- 875 876 877PC-Style Function Keys 878If xterm does minimal translation of the function keys, it usually does 879this with a PC-style keyboard, so PC-style function keys result. Sun 880keyboards are similar to PC keyboards. Both have cursor and scrolling 881operations printed on the keypad, which duplicate the smaller cursor and 882scrolling keypads. 883X does not predefine NumLock (used for VT220 keyboards) or Alt (used as 884an extension for the Sun/PC keyboards) as modifiers. These keys are 885recognized as modifiers when enabled by the numLock resource, or by the 886DECSET 1 0 3 5 control sequence. 887The cursor keys transmit the following escape sequences depending on the 888mode specified via the DECCKM escape sequence. 889 890 Key Normal Application 891 -------------------------------------- 892 Cursor Up CSI A SS3 A 893 Cursor Down CSI B SS3 B 894 Cursor Right CSI C SS3 C 895 Cursor Left CSI D SS3 D 896 -------------------------------------- 897 898The home- and end-keys (unlike PageUp and other keys also on the 6-key 899editing keypad) are considered "cursor keys" by xterm. Their mode is 900also controlled by the DECCKM escape sequence: 901 902 Key Normal Application 903 ---------------------------------- 904 Home CSI H SS3 H 905 End CSI F SS3 F 906 ---------------------------------- 907 908The application keypad transmits the following escape sequences depend- 909ing on the mode specified via the DECPNM and DECPAM escape sequences. 910Use the NumLock key to override the application mode. 911Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are 912supported by the program. 913 914 Key Numeric Application Terminfo Termcap 915 -------------------------------------------------------------- 916 Space SP SS3 SP - - 917 Tab TAB SS3 I - - 918 Enter CR SS3 M kent @8 919 PF1 SS3 P SS3 P kf1 k1 920 PF2 SS3 Q SS3 Q kf2 k2 921 PF3 SS3 R SS3 R kf3 k3 922 PF4 SS3 S SS3 S kf4 k4 923 * (multiply) * SS3 j - - 924 + (add) + SS3 k - - 925 , (comma) , SS3 l - - 926 - (minus) - SS3 m - - 927 . (Delete) . CSI 3 ~ - - 928 / (divide) / SS3 o - - 929 0 (Insert) 0 CSI 2 ~ - - 930 1 (End) 1 SS3 F kc1 K4 931 2 (DownArrow) 2 CSI B - - 932 3 (PageDown) 3 CSI 6 ~ kc3 K5 933 4 (LeftArrow) 4 CSI D - - 934 5 (Begin) 5 CSI E kb2 K2 935 6 (RightArrow) 6 CSI C - - 936 7 (Home) 7 SS3 H ka1 K1 937 8 (UpArrow) 8 CSI A - - 938 9 (PageUp) 9 CSI 5 ~ ka3 K3 939 = (equal) = SS3 X - - 940 -------------------------------------------------------------- 941 942They also provide 12 function keys, as well as a few other special-pur- 943pose keys. 944 945 Key Escape Sequence 946 --------------------------- 947 F1 SS3 P 948 F2 SS3 Q 949 F3 SS3 R 950 F4 SS3 S 951 F5 CSI 1 5 ~ 952 F6 CSI 1 7 ~ 953 F7 CSI 1 8 ~ 954 F8 CSI 1 9 ~ 955 F9 CSI 2 0 ~ 956 F10 CSI 2 1 ~ 957 F11 CSI 2 3 ~ 958 F12 CSI 2 4 ~ 959 --------------------------- 960 961Older versions of xterm implement different escape sequences for F1 962through F4. These can be activated by setting the oldXtermFKeys 963resource. However, since they do not correspond to any hardware termi- 964nal, they have been deprecated. (The DEC VT220 reserves F1 through F5 965for local functions such as Setup). 966 967 Key Escape Sequence 968 --------------------------- 969 F1 CSI 1 1 ~ 970 F2 CSI 1 2 ~ 971 F3 CSI 1 3 ~ 972 F4 CSI 1 4 ~ 973 --------------------------- 974 975In normal mode, i.e., a Sun/PC keyboard when the sunKeyboard resource is 976false, xterm recognizes function key modifiers which are parameters 977appended before the final character of the control sequence. 978 979 Code Modifiers 980 --------------------------------- 981 2 Shift 982 3 Alt 983 4 Shift + Alt 984 5 Control 985 6 Shift + Control 986 7 Alt + Control 987 8 Shift + Alt + Control 988 --------------------------------- 989 990For example, shift-F5 would be sent as CSI 1 5 ; 2 ~ 991If the alwaysUseMods resource is set, the Meta modifier also is recog- 992nized, making parameters 9 through 16. 993 994VT220-Style Function Keys 995However, xterm is most useful as a DEC VT102 or VT220 emulator. Set the 996sunKeyboard resource to true to force a Sun/PC keyboard to act like a 997VT220 keyboard. 998 999The VT102/VT220 application keypad transmits unique escape sequences in 1000application mode, which are distinct from the cursor and scrolling key- 1001pad: 1002 1003 Key Numeric Application 1004 -------------------------------------- 1005 Space SP SS3 SP 1006 Tab TAB SS3 I 1007 Enter CR SS3 M 1008 PF1 SS3 P SS3 P 1009 PF2 SS3 Q SS3 Q 1010 PF3 SS3 R SS3 R 1011 PF4 SS3 S SS3 S 1012 * (multiply) * SS3 j 1013 + (add) + SS3 k 1014 , (comma) , SS3 l 1015 - (minus) - SS3 m 1016 . (period) . SS3 n 1017 / (divide) / SS3 o 1018 0 0 SS3 p 1019 1 1 SS3 q 1020 2 2 SS3 r 1021 3 3 SS3 s 1022 4 4 SS3 t 1023 5 5 SS3 u 1024 6 6 SS3 v 1025 7 7 SS3 w 1026 8 8 SS3 x 1027 9 9 SS3 y 1028 = (equal) = SS3 X 1029 -------------------------------------- 1030 1031The VT220 provides a 6-key editing keypad, which is analogous to that on 1032the PC keyboard. It is not affected by DECCKM or DECPNM/DECPAM: 1033 1034 Key Normal Application 1035 ---------------------------------- 1036 Insert CSI 2 ~ CSI 2 ~ 1037 Delete CSI 3 ~ CSI 3 ~ 1038 Home CSI 1 ~ CSI 1 ~ 1039 End CSI 4 ~ CSI 4 ~ 1040 PageUp CSI 5 ~ CSI 5 ~ 1041 PageDown CSI 6 ~ CSI 6 ~ 1042 ---------------------------------- 1043 1044The VT220 provides 8 additional function keys. With a Sun/PC keyboard, 1045access these keys by Control/F1 for F13, etc. 1046 1047 Key Escape Sequence 1048 --------------------------- 1049 F13 CSI 2 5 ~ 1050 F14 CSI 2 6 ~ 1051 F15 CSI 2 8 ~ 1052 F16 CSI 2 9 ~ 1053 F17 CSI 3 1 ~ 1054 F18 CSI 3 2 ~ 1055 F19 CSI 3 3 ~ 1056 F20 CSI 3 4 ~ 1057 --------------------------- 1058 1059 1060VT52-Style Function Keys 1061A VT52 does not have function keys, but it does have a numeric keypad 1062and cursor keys. They differ from the other emulations by the prefix. 1063Also, the cursor keys do not change: 1064 1065 Key Normal/Application 1066 ---------------------------------- 1067 Cursor Up ESC A 1068 Cursor Down ESC B 1069 Cursor Right ESC C 1070 Cursor Left ESC D 1071 ---------------------------------- 1072 1073The keypad is similar: 1074 1075 Key Numeric Application 1076 -------------------------------------- 1077 Space SP ESC ? SP 1078 Tab TAB ESC ? I 1079 Enter CR ESC ? M 1080 PF1 ESC P ESC P 1081 PF2 ESC Q ESC Q 1082 PF3 ESC R ESC R 1083 PF4 ESC S ESC S 1084 * (multiply) * ESC ? j 1085 + (add) + ESC ? k 1086 , (comma) , ESC ? l 1087 - (minus) - ESC ? m 1088 . (period) . ESC ? n 1089 / (divide) / ESC ? o 1090 0 0 ESC ? p 1091 1 1 ESC ? q 1092 2 2 ESC ? r 1093 3 3 ESC ? s 1094 4 4 ESC ? t 1095 5 5 ESC ? u 1096 6 6 ESC ? v 1097 7 7 ESC ? w 1098 8 8 ESC ? x 1099 9 9 ESC ? y 1100 = (equal) = ESC ? X 1101 -------------------------------------- 1102 1103 1104Sun-Style Function Keys 1105The xterm program provides support for Sun keyboards more directly, by a 1106menu toggle that causes it to send Sun-style function key codes rather 1107than VT220. Note, however, that the sun and VT100 emulations are not 1108really compatible. For example, their wrap-margin behavior differs. 1109Only function keys are altered; keypad and cursor keys are the same. 1110The emulation responds identically. See the xterm-sun terminfo entry 1111for details. 1112 1113HP-Style Function Keys 1114Similarly, xterm can be compiled to support HP keyboards. See the 1115xterm-hp terminfo entry for details. 1116 1117The Alternate Screen Buffer 1118Xterm maintains two screen buffers. The normal screen buffer allows you 1119to scroll back to view saved lines of output up to the maximum set by 1120the saveLines resource. The alternate screen buffer is exactly as large 1121as the display, contains no additional saved lines. When the alternate 1122screen buffer is active, you cannot scroll back to view saved lines. 1123Xterm provides control sequences and menu entries for switching between 1124the two. 1125 1126Most full-screen applications use terminfo or termcap to obtain strings 1127used to start/stop full-screen mode, i.e., smcup and rmcup for terminfo, 1128or the corresponding ti and te for termcap. The titeInhibit resource 1129removes the ti and te strings from the TERMCAP string which is set in 1130the environment for some platforms. That is not done when xterm is 1131built with terminfo libraries because terminfo does not provide the 1132whole text of the termcap data in one piece. It would not work for ter- 1133minfo anyway, since terminfo data is not passed in environment vari- 1134ables; setting an environment variable in this manner would have no 1135effect on the application's ability to switch between normal and alter- 1136nate screen buffers. Instead, the newer private mode controls (such as 11371 0 4 9 ) for switching between normal and alternate screen buffers sim- 1138ply disable the switching. They add other features such as clearing the 1139display for the same reason: to make the details of switching indepen- 1140dent of the application that requests the switch. 1141 1142Bracketed Paste Mode 1143When bracketed paste mode is set, pasted text is bracketed with control 1144sequences so that the program can differentiate pasted text from typed- 1145in text. When bracketed paste mode is set, the program will receive: 1146ESC [ 200 ~, followed by the pasted text, followed by ESC [ 201 ~. 1147 1148Mouse Tracking 1149The VT widget can be set to send the mouse position and other informa- 1150tion on button presses. These modes are typically used by editors and 1151other full-screen applications that want to make use of the mouse. 1152 1153There are six mutually exclusive modes. One is DEC Locator mode, 1154enabled by the DECELR CSI Ps ; Ps ' z control sequence, and is not 1155described here (control sequences are summarized above). The remaining 1156five modes are each enabled (or disabled) by a different parameter in 1157DECSET CSI ? Pm h or DECRST CSI ? Pm l control sequence. 1158 1159Manifest constants for the parameter values are defined in xcharmouse.h 1160as follows: 1161 1162 #define SET_X10_MOUSE 9 1163 #define SET_VT200_MOUSE 1000 1164 #define SET_VT200_HIGHLIGHT_MOUSE 1001 1165 #define SET_BTN_EVENT_MOUSE 1002 1166 #define SET_ANY_EVENT_MOUSE 1003 1167 1168 #define SET_FOCUS_EVENT_MOUSE 1004 1169 1170The motion reporting modes are strictly xterm extensions, and are not 1171part of any standard, though they are analogous to the DEC VT200 DECELR 1172locator reports. 1173 1174Parameters (such as pointer position and button number) for all mouse 1175tracking escape sequences generated by xterm encode numeric parameters 1176in a single character as value+32. For example, ! specifies the value 11771. The upper left character position on the terminal is denoted as 1,1. 1178 1179X10 compatibility mode sends an escape sequence only on button press, 1180encoding the location and the mouse button pressed. It is enabled by 1181specifying parameter 9 to DECSET. On button press, xterm sends CSI M 1182CbCxCy (6 characters). Cb is button-1. Cx and Cy are the x and y coor- 1183dinates of the mouse when the button was pressed. 1184 1185Normal tracking mode sends an escape sequence on both button press and 1186release. Modifier key (shift, ctrl, meta) information is also sent. It 1187is enabled by specifying parameter 1000 to DECSET. On button press or 1188release, xterm sends CSI M CbCxCy. The low two bits of Cb encode button 1189information: 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release. 1190The next three bits encode the modifiers which were down when the button 1191was pressed and are added together: 4=Shift, 8=Meta, 16=Control. Note 1192however that the shift and control bits are normally unavailable because 1193xterm uses the control modifier with mouse for popup menus, and the 1194shift modifier is used in the default translations for button events. 1195The Meta modifier recognized by xterm is the mod1 mask, and is not nec- 1196essarily the "Meta" key (see xmodmap). Cx and Cy are the x and y coor- 1197dinates of the mouse event, encoded as in X10 mode. 1198 1199Wheel mice may return buttons 4 and 5. Those buttons are represented by 1200the same event codes as buttons 1 and 2 respectively, except that 64 is 1201added to the event code. Release events for the wheel buttons are not 1202reported. 1203 1204Mouse highlight tracking notifies a program of a button press, receives 1205a range of lines from the program, highlights the region covered by the 1206mouse within that range until button release, and then sends the program 1207the release coordinates. It is enabled by specifying parameter 1001 to 1208DECSET. Highlighting is performed only for button 1, though other but- 1209ton events can be received. Warning: use of this mode requires a coop- 1210erating program or it will hang xterm. On button press, the same infor- 1211mation as for normal tracking is generated; xterm then waits for the 1212program to send mouse tracking information. All X events are ignored 1213until the proper escape sequence is received from the pty: CSI Ps ; Ps ; 1214Ps ; Ps ; Ps T . The parameters are func, startx, starty, firstrow, and 1215lastrow. func is non-zero to initiate highlight tracking and zero to 1216abort. startx and starty give the starting x and y location for the 1217highlighted region. The ending location tracks the mouse, but will 1218never be above row firstrow and will always be above row lastrow. (The 1219top of the screen is row 1.) When the button is released, xterm reports 1220the ending position one of two ways: if the start and end coordinates 1221are valid text locations: CSI t CxCy. If either coordinate is past the 1222end of the line: CSI T CxCyCxCyCxCy. The parameters are startx, starty, 1223endx, endy, mousex, and mousey. startx, starty, endx, and endy give the 1224starting and ending character positions of the region. mousex and 1225mousey give the location of the mouse at button up, which may not be 1226over a character. 1227 1228Button-event tracking is essentially the same as normal tracking, but 1229xterm also reports button-motion events. Motion events are reported 1230only if the mouse pointer has moved to a different character cell. It 1231is enabled by specifying parameter 1002 to DECSET. On button press or 1232release, xterm sends the same codes used by normal tracking mode. On 1233button-motion events, xterm adds 32 to the event code (the third charac- 1234ter, Cb). The other bits of the event code specify button and modifier 1235keys as in normal mode. For example, motion into cell x,y with button 1 1236down is reported as CSI M @ CxCy. ( @ = 32 + 0 (button 1) + 32 (motion 1237indicator) ). Similarly, motion with button 3 down is reported as CSI M 1238B CxCy. ( B = 32 + 2 (button 3) + 32 (motion indicator) ). 1239 1240Any-event mode is the same as button-event mode, except that all motion 1241events are reported, even if no mouse button is down. It is enabled by 1242specifying 1003 to DECSET. 1243 1244FocusIn/FocusOut can be combined with any of the mouse events since it 1245uses a different protocol. When set, it causes xterm to send CSI I 1246when the terminal gains focus, and CSI O when it loses focus. 1247 1248Tektronix 4014 Mode 1249Most of these sequences are standard Tektronix 4014 control sequences. 1250Graph mode supports the 12-bit addressing of the Tektronix 4014. The 1251major features missing are the write-through and defocused modes. This 1252document does not describe the commands used in the various Tektronix 1253plotting modes but does describe the commands to switch modes. 1254 1255BEL Bell (Ctrl-G) 1256BS Backspace (Ctrl-H) 1257TAB Horizontal Tab (Ctrl-I) 1258LF Line Feed or New Line (Ctrl-J) 1259VT Cursor up (Ctrl-K) 1260FF Form Feed or New Page (Ctrl-L) 1261CR Carriage Return (Ctrl-M) 1262ESC ETX Switch to VT100 Mode (ESC Ctrl-C) 1263ESC ENQ Return Terminal Status (ESC Ctrl-E) 1264ESC FF PAGE (Clear Screen) (ESC Ctrl-L) 1265ESC SO Begin 4015 APL mode (ignored by xterm) (ESC Ctrl-N) 1266ESC SI End 4015 APL mode (ignored by xterm) (ESC Ctrl-O) 1267ESC ETB COPY (Save Tektronix Codes to file COPYyyyy-mm-dd.hh:mm:ss) 1268 (ESC Ctrl-W) 1269ESC CAN Bypass Condition (ESC Ctrl-X) 1270ESC SUB GIN mode (ESC Ctrl-Z) 1271ESC FS Special Point Plot Mode (ESC Ctrl-\) 1272ESC 8 Select Large Character Set 1273ESC 9 Select #2 Character Set 1274ESC : Select #3 Character Set 1275ESC ; Select Small Character Set 1276OSC Ps ; Pt BEL 1277 Set Text Parameters of VT window 1278 Ps = 0 -> Change Icon Name and Window Title to Pt 1279 Ps = 1 -> Change Icon Name to Pt 1280 Ps = 2 -> Change Window Title to Pt 1281 Ps = 4 6 -> Change Log File to Pt (normally disabled by a 1282 compile-time option) 1283ESC ` Normal Z Axis and Normal (solid) Vectors 1284ESC a Normal Z Axis and Dotted Line Vectors 1285ESC b Normal Z Axis and Dot-Dashed Vectors 1286ESC c Normal Z Axis and Short-Dashed Vectors 1287ESC d Normal Z Axis and Long-Dashed Vectors 1288ESC h Defocused Z Axis and Normal (solid) Vectors 1289ESC i Defocused Z Axis and Dotted Line Vectors 1290ESC j Defocused Z Axis and Dot-Dashed Vectors 1291ESC k Defocused Z Axis and Short-Dashed Vectors 1292ESC l Defocused Z Axis and Long-Dashed Vectors 1293ESC p Write-Thru Mode and Normal (solid) Vectors 1294ESC q Write-Thru Mode and Dotted Line Vectors 1295ESC r Write-Thru Mode and Dot-Dashed Vectors 1296ESC s Write-Thru Mode and Short-Dashed Vectors 1297ESC t Write-Thru Mode and Long-Dashed Vectors 1298FS Point Plot Mode (Ctrl-\) 1299GS Graph Mode (Ctrl-]) 1300RS Incremental Plot Mode (Ctrl-^) 1301US Alpha Mode (Ctrl-_) 1302 1303VT52 Mode 1304Parameters for cursor movement are at the end of the ESC Y escape 1305sequence. Each ordinate is encoded in a single character as value+32. 1306For example, ! is 1. The screen coordinate system is 0-based. 1307 1308ESC A Cursor up. 1309ESC B Cursor down. 1310ESC C Cursor right. 1311ESC D Cursor left. 1312ESC F Enter graphics mode. 1313ESC G Exit graphics mode. 1314ESC H Move the cursor to the home position. 1315ESC I Reverse line feed. 1316ESC J Erase from the cursor to the end of the screen. 1317ESC K Erase from the cursor to the end of the line. 1318ESC Y Ps Ps 1319 Move the cursor to given row and column. 1320ESC Z Identify 1321 -> ESC / Z (``I am a VT52.'') 1322ESC = Enter alternate keypad mode. 1323ESC > Exit alternate keypad mode. 1324ESC < Exit VT52 mode (Enter VT100 mode). 1325