123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306 |
- Xterm Control Sequences
- Edward Moy
- University of California, Berkeley
- Revised by
- Stephen Gildea
- X Consortium
- Definitions
- c The literal character c.
- C A single (required) character.
- Ps A single (usually optional) numeric parameter, composed of one of more
- digits.
- Pm A multiple numeric parameter composed of any number of single numeric
- parameters, separated by ; character(s).
- Pt A text parameter composed of printable characters.
- VT100 Mode
- Most of these control sequences are standard VT102 control sequences, but
- there are some sequences here from later DEC VT terminals, too. VT102
- features not supported are smooth scrolling, double size characters, blink-
- ing characters, and VT52 mode. There are additional control sequences to
- provide xterm-dependent functions, like the scrollbar or window size. Where
- the function is specified by DEC or ISO 6429, the code assigned to it is
- given in parentheses. The escape codes to designate and invoke character
- sets are specified by ISO 2022; see that document for a discussion of char-
- acter sets.
- BEL Bell (Ctrl-G)
- BS Backspace (Ctrl-H)
- TAB Horizontal Tab (HT) (Ctrl-I)
- LF Line Feed or New Line (NL) (Ctrl-J)
- VT Vertical Tab (Ctrl-K) same as LF
- FF Form Feed or New Page (NP) (Ctrl-L) same as LF
- CR Carriage Return (Ctrl-M)
- SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set:
- invokes the G1 character set.
- SI Shift In (Ctrl-O) -> Switch to Standard Character Set:
- invokes the G0 character set (the default).
- ESC # 8 DEC Screen Alignment Test (DECALN)
- ESC ( C Designate G0 Character Set (ISO 2022)
- C = 0 -> DEC Special Character and Line Drawing Set
- C = A -> United Kingdom (UK)
- C = B -> United States (USASCII)
- ESC ) C Designate G1 Character Set (ISO 2022)
- C = 0 -> DEC Special Character and Line Drawing Set
- C = A -> United Kingdom (UK)
- C = B -> United States (USASCII)
- ESC * C Designate G2 Character Set (ISO 2022)
- C = 0 -> DEC Special Character and Line Drawing Set
- C = A -> United Kingdom (UK)
- C = B -> United States (USASCII)
- ESC + C Designate G3 Character Set (ISO 2022)
- C = 0 -> DEC Special Character and Line Drawing Set
- C = A -> United Kingdom (UK)
- C = B -> United States (USASCII)
- ESC 7 Save Cursor (DECSC)
- ESC 8 Restore Cursor (DECRC)
- ESC = Application Keypad (DECPAM)
- ESC > Normal Keypad (DECPNM)
- ESC D Index (IND)
- ESC E Next Line (NEL)
- ESC F Cursor to lower left corner of screen (if enabled by the
- hpLowerleftBugCompat resource).
- ESC H Tab Set (HTS)
- ESC M Reverse Index (RI)
- ESC N Single Shift Select of G2 Character Set (SS2): affects next
- character only
- ESC O Single Shift Select of G3 Character Set (SS3): affects next
- character only
- ESC P Pt ESC \ Device Control String (DCS)
- xterm implements no DCS functions; Pt is ignored. Pt need
- not be printable characters.
- ESC Z Return Terminal ID (DECID). Obsolete form of ESC [ c (DA).
- ESC [ Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH)
- ESC [ Ps A Cursor Up Ps Times (default = 1) (CUU)
- ESC [ Ps B Cursor Down Ps Times (default = 1) (CUD)
- ESC [ Ps C Cursor Forward Ps Times (default = 1) (CUF)
- ESC [ Ps D Cursor Backward Ps Times (default = 1) (CUB)
- ESC [ Ps ; Ps H Cursor Position [row;column] (default = [1,1]) (CUP)
- ESC [ Ps J Erase in Display (ED)
- Ps = 0 -> Clear Below (default)
- Ps = 1 -> Clear Above
- Ps = 2 -> Clear All
- ESC [ Ps K Erase in Line (EL)
- Ps = 0 -> Clear to Right (default)
- Ps = 1 -> Clear to Left
- Ps = 2 -> Clear All
- ESC [ Ps L Insert Ps Line(s) (default = 1) (IL)
- ESC [ Ps M Delete Ps Line(s) (default = 1) (DL)
- ESC [ Ps P Delete Ps Character(s) (default = 1) (DCH)
- ESC [ Ps ; Ps ; Ps ; Ps ; Ps T
- Initiate hilite mouse tracking. Parameters are
- [func;startx;starty;firstrow;lastrow]. See the section Mouse
- Tracking.
- ESC [ Ps c Send Device Attributes (DA)
- Ps = 0 or omitted -> request attributes from terminal
- -> ESC [ ? 1 ; 2 c (``I am a VT100 with Advanced Video
- Option.'')
- ESC [ Ps ; Ps f Horizontal and Vertical Position [row;column] (default =
- [1,1]) (HVP)
- ESC [ Ps g Tab Clear (TBC)
- Ps = 0 -> Clear Current Column (default)
- Ps = 3 -> Clear All
- ESC [ Pm h Set Mode (SM)
- Ps = 4 -> Insert Mode (IRM)
- Ps = 2 0 -> Automatic Newline (LNM)
- ESC [ Pm l Reset Mode (RM)
- Ps = 4 -> Replace Mode (IRM)
- Ps = 2 0 -> Normal Linefeed (LNM)
- ESC [ Pm m Character Attributes (SGR)
- Ps = 0 -> Normal (default)
- Ps = 1 -> Bold
- Ps = 4 -> Underscore
- Ps = 5 -> Blink (appears as Bold)
- Ps = 7 -> Inverse
- ESC [ Ps n Device Status Report (DSR)
- Ps = 5 -> Status Report ESC [ 0 n (``OK'')
- Ps = 6 -> Report Cursor Position (CPR) [row;column] as ESC
- [ r ; c R
- ESC [ Ps ; Ps r Set Scrolling Region [top;bottom] (default = full size of
- window) (DECSTBM)
- ESC [ Ps x Request Terminal Parameters (DECREQTPARM)
- ESC [ ? Pm h DEC Private Mode Set (DECSET)
- Ps = 1 -> Application Cursor Keys (DECCKM)
- Ps = 2 -> Designate USASCII for character sets G0-G3. (In
- the VT102, this selects VT52 mode (DECANM), which xterm
- doesn't support.)
- Ps = 3 -> 132 Column Mode (DECCOLM)
- Ps = 4 -> Smooth (Slow) Scroll (DECSCLM)
- Ps = 5 -> Reverse Video (DECSCNM)
- Ps = 6 -> Origin Mode (DECOM)
- Ps = 7 -> Wraparound Mode (DECAWM)
- Ps = 8 -> Auto-repeat Keys (DECARM)
- Ps = 9 -> Send Mouse X & Y on button press. See the sec-
- tion Mouse Tracking.
- Ps = 3 8 -> Enter Tektronix Mode (DECTEK)
- Ps = 4 0 -> Allow 80 <--> 132 Mode
- Ps = 4 1 -> more(1) fix (see curses resource)
- Ps = 4 4 -> Turn On Margin Bell
- Ps = 4 5 -> Reverse-wraparound Mode
- Ps = 4 6 -> Start Logging (normally disabled by a
- compile-time option)
- Ps = 4 7 -> Use Alternate Screen Buffer (unless disabled
- by the titeInhibit resource)
- Ps = 1 0 0 0 -> Send Mouse X & Y on button press and
- release. See the section Mouse Tracking.
- Ps = 1 0 0 1 -> Use Hilite Mouse Tracking. See the sec-
- tion Mouse Tracking.
- ESC [ ? Pm l DEC Private Mode Reset (DECRST)
- Ps = 1 -> Normal Cursor Keys (DECCKM)
- Ps = 3 -> 80 Column Mode (DECCOLM)
- Ps = 4 -> Jump (Fast) Scroll (DECSCLM)
- Ps = 5 -> Normal Video (DECSCNM)
- Ps = 6 -> Normal Cursor Mode (DECOM)
- Ps = 7 -> No Wraparound Mode (DECAWM)
- Ps = 8 -> No Auto-repeat Keys (DECARM)
- Ps = 9 -> Don't Send Mouse X & Y on button press
- Ps = 4 0 -> Disallow 80 <--> 132 Mode
- Ps = 4 1 -> No more(1) fix (see curses resource)
- Ps = 4 4 -> Turn Off Margin Bell
- Ps = 4 5 -> No Reverse-wraparound Mode
- Ps = 4 6 -> Stop Logging (normally disabled by a compile-
- time option)
- Ps = 4 7 -> Use Normal Screen Buffer
- Ps = 1 0 0 0 -> Don't Send Mouse X & Y on button press and
- release
- Ps = 1 0 0 1 -> Don't Use Hilite Mouse Tracking
- ESC [ ? Pm r Restore DEC Private Mode Values. The value of Ps previously
- saved is restored. Ps values are the same as for DECSET.
- ESC [ ? Pm s Save DEC Private Mode Values. Ps values are the same as for
- DECSET.
- ESC ] Ps ; Pt BEL
- Set Text Parameters
- Ps = 0 -> Change Icon Name and Window Title to Pt
- Ps = 1 -> Change Icon Name to Pt
- Ps = 2 -> Change Window Title to Pt
- Ps = 4 6 -> Change Log File to Pt (normally disabled by a
- compile-time option)
- Ps = 5 0 -> Set Font to Pt
- ESC ^ Pt ESC \ Privacy Message (PM)
- xterm implements no PM functions; Pt is ignored. Pt need
- not be printable characters.
- ESC _ Pt ESC \ Application Program Command (APC)
- xterm implements no APC functions; Pt is ignored. Pt need
- not be printable characters.
- ESC c Full Reset (RIS)
- ESC l Memory Lock (per HP terminals). Locks memory above the cur-
- sor.
- ESC m Memory Unlock (per HP terminals)
- ESC n Invoke the G2 Character Set (LS2)
- ESC o Invoke the G3 Character Set (LS3)
- ESC | Invoke the G3 Character Set as GR (LS3R). Has no visible
- effect in xterm.
- ESC } Invoke the G2 Character Set as GR (LS2R). Has no visible
- effect in xterm.
- ESC ~ Invoke the G1 Character Set as GR (LS1R). Has no visible
- effect in xterm.
- Mouse Tracking
- The VT widget can be set to send the mouse position and other information on
- button presses. These modes are typically used by editors and other full-
- screen applications that want to make use of the mouse.
- There are three mutually exclusive modes, each enabled (or disabled) by a
- different parameter in the DECSET (or DECRST) escape sequence. Parameters
- for all mouse tracking escape sequences generated by xterm encode numeric
- parameters in a single character as value+040. For example, ! is 1. The
- screen coodinate system is 1-based.
- X10 compatibility mode sends an escape sequence on button press encoding the
- location and the mouse button pressed. It is enabled by specifying parame-
- ter 9 to DECSET. On button press, xterm sends ESC [ M CbCxCy (6 charac-
- ters). Cb is button-1. Cx and Cy are the x and y coordinates of the mouse
- when the button was pressed.
- Normal tracking mode sends an escape sequence on both button press and
- release. Modifier information is also sent. It is enabled by specifying
- parameter 1000 to DECSET. On button press or release, xterm sends ESC [ M
- CbCxCy. The low two bits of Cb encode button information: 0=MB1 pressed,
- 1=MB2 pressed, 2=MB3 pressed, 3=release. The upper bits encode what modif-
- iers were down when the button was pressed and are added together. 4=Shift,
- 8=Meta, 16=Control. Cx and Cy are the x and y coordinates of the mouse
- event. The upper left corner is (1,1).
- Mouse hilite tracking notifies a program of a button press, receives a range
- of lines from the program, highlights the region covered by the mouse within
- that range until button release, and then sends the program the release
- coordinates. It is enabled by specifying parameter 1001 to DECSET. Warn-
- ing: use of this mode requires a cooperating program or it will hang xterm.
- On button press, the same information as for normal tracking is generated;
- xterm then waits for the program to send mouse tracking information. All X
- events are ignored until the proper escape sequence is received from the
- pty: ESC [ Ps ; Ps ; Ps ; Ps ; Ps T . The parameters are func, startx,
- starty, firstrow, and lastrow. func is non-zero to initiate hilite tracking
- and zero to abort. startx and starty give the starting x and y location for
- the highlighted region. The ending location tracks the mouse, but will
- never be above row firstrow and will always be above row lastrow. (The top
- of the screen is row 1.) When the button is released, xterm reports the
- ending position one of two ways: if the start and end coordinates are valid
- text locations: ESC [ t CxCy. If either coordinate is past the end of the
- line: ESC [ T CxCyCxCyCxCy. The parameters are startx, starty, endx, endy,
- mousex, and mousey. startx, starty, endx, and endy give the starting and
- ending character positions of the region. mousex and mousey give the loca-
- tion of the mouse at button up, which may not be over a character.
- Tektronix 4014 Mode
- Most of these sequences are standard Tektronix 4014 control sequences.
- Graph mode supports the 12-bit addressing of the Tektronix 4014. The major
- features missing are the write-thru and defocused modes. This document does
- not describe the commands used in the various Tektronix plotting modes but
- does describe the commands to switch modes.
- BEL Bell (Ctrl-G)
- BS Backspace (Ctrl-H)
- TAB Horizontal Tab (Ctrl-I)
- LF Line Feed or New Line (Ctrl-J)
- VT Cursor up (Ctrl-K)
- FF Form Feed or New Page (Ctrl-L)
- CR Carriage Return (Ctrl-M)
- ESC ETX Switch to VT100 Mode (ESC Ctrl-C)
- ESC ENQ Return Terminal Status (ESC Ctrl-E)
- ESC FF PAGE (Clear Screen) (ESC Ctrl-L)
- ESC SO Begin 4015 APL mode (ignored by xterm) (ESC Ctrl-N)
- ESC SI End 4015 APL mode (ignored by xterm) (ESC Ctrl-O)
- ESC ETB COPY (Save Tektronix Codes to file COPYyy-mm-dd.hh:mm:ss)
- (ESC Ctrl-W)
- ESC CAN Bypass Condition (ESC Ctrl-X)
- ESC SUB GIN mode (ESC Ctrl-Z)
- ESC FS Special Point Plot Mode (ESC Ctrl-\)
- ESC 8 Select Large Character Set
- ESC 9 Select #2 Character Set
- ESC : Select #3 Character Set
- ESC ; Select Small Character Set
- ESC ] Ps ; Pt BEL
- Set Text Parameters of VT window
- Ps = 0 -> Change Icon Name and Window Title to Pt
- Ps = 1 -> Change Icon Name to Pt
- Ps = 2 -> Change Window Title to Pt
- Ps = 4 6 -> Change Log File to Pt (normally disabled by a
- compile-time option)
- ESC ` Normal Z Axis and Normal (solid) Vectors
- ESC a Normal Z Axis and Dotted Line Vectors
- ESC b Normal Z Axis and Dot-Dashed Vectors
- ESC c Normal Z Axis and Short-Dashed Vectors
- ESC d Normal Z Axis and Long-Dashed Vectors
- ESC h Defocused Z Axis and Normal (solid) Vectors
- ESC i Defocused Z Axis and Dotted Line Vectors
- ESC j Defocused Z Axis and Dot-Dashed Vectors
- ESC k Defocused Z Axis and Short-Dashed Vectors
- ESC l Defocused Z Axis and Long-Dashed Vectors
- ESC p Write-Thru Mode and Normal (solid) Vectors
- ESC q Write-Thru Mode and Dotted Line Vectors
- ESC r Write-Thru Mode and Dot-Dashed Vectors
- ESC s Write-Thru Mode and Short-Dashed Vectors
- ESC t Write-Thru Mode and Long-Dashed Vectors
- FS Point Plot Mode (Ctrl-\)
- GS Graph Mode (Ctrl-])
- RS Incremental Plot Mode (Ctrl-^)
- US Alpha Mode (Ctrl-_)
|