Page: 1 2 3 4 5 6

Appendix A


Xterm Control Sequences

Definitions
The literal character c.
CA single (required) character.
Ps A single (usually optional) numeric parameter, composed of one of more digits.
PmA multiple numeric parameter composed of any number of single numeric parameters, separated by character(s).
PtA 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. Major VT102 features not supported are smooth scrolling, double size characters, blinking 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 character sets are specified by ISO 2022; see that document for a discussion of character sets.

Bell (Ctrl-G)
Backspace (Ctrl-H)
Horizontal Tab (HT) (Ctrl-I)
Line Feed or New Line (NL) (Ctrl-J)
Vertical Tab (Ctrl-K) same as LF
Form Feed or New Page (NP) (Ctrl-L) same as LF
Carriage Return (Ctrl-M)
Shift Out (Ctrl-N) Switch to Alternate Character Set: invokes the G1 character set.
Shift In (Ctrl-O) Switch to Standard Character Set: invokes the G0 character set (the default).
DEC Screen Alignment Test (DECALN)
CDesignate G0 Character Set (ISO 2022)
C = DEC Special Character and Line Drawing Set
C = United Kingdom (UK)
C = United States (USASCII)
CDesignate G1 Character Set (ISO 2022)
C = DEC Special Character and Line Drawing Set
C = United Kingdom (UK)
C = United States (USASCII)
CDesignate G2 Character Set (ISO 2022)
C = DEC Special Character and Line Drawing Set
C = United Kingdom (UK)
C = United States (USASCII)
CDesignate G3 Character Set (ISO 2022)
C = DEC Special Character and Line Drawing Set
C = United Kingdom (UK)
C = United States (USASCII)

Home

Save Cursor (DECSC)
Restore Cursor (DECRC)
Application Keypad (DECPAM)
Normal Keypad (DECPNM)
Index (IND)
Next Line (NEL)
Tab Set (HTS)
Reverse Index (RI)
Single Shift Select of G2 Character Set (SS2): affects next character only
Single Shift Select of G3 Character Set (SS3): affects next character only
Pt Device Control String (DCS)
xterm implements no DCS functions; Pt is ignored. Pt need not be printable characters.
Return Terminal ID (DECID). Obsolete form of (DA).
Ps Insert Ps (Blank) Character(s) (default = 1) (ICH)
Ps Cursor Up Ps Times (default = 1) (CUU)
Ps Cursor Down Ps Times (default = 1) (CUD)
Ps Cursor Forward Ps Times (default = 1) (CUF)
Ps Cursor Backward Ps Times (default = 1) (CUB)
Ps Ps Cursor Position [row;column] (default = [1,1]) (CUP)
Ps Erase in Display (ED)
Ps = Clear Below (default)
Ps = Clear Above
Ps = Clear All
Ps Erase in Line (EL)
Ps = Clear to Right (default)
Ps = Clear to Left
Ps = Clear All
Ps Insert Ps Line(s) (default = 1) (IL)
Ps Delete Ps Line(s) (default = 1) (DL)
Ps Delete Ps Character(s) (default = 1) (DCH)
Ps Ps Ps Ps Ps Initiate hilite mouse tracking. Parameters are [func;startx;starty;firstrow;lastrow]. See the section Mouse Tracking.
Ps Send Device Attributes (DA)
Ps = m or omitted o request attributes from terminal
("I am a VT100 with Advanced Video Option.")

Home

Ps Ps Horizontal and Vertical Position [row;column] (default = [1,1]) (HVP)
Ps Tab Clear (TBC)
Ps = Clear Current Column (default)
Ps = Clear All
Pm Set Mode (SM)
Pm = Insert Mode (IRM)
Pm = Automatic Newline (LNM)
Pm Reset Mode (RM)
Ps = Replace Mode (IRM)
Ps = Normal Linefeed (LNM)
Pm CharacterAttributes (SGR)
Ps = Normal (default)
Ps = Bold
Ps = Underscore
Ps = Blink(appears as Bold)
Ps = Inverse
Ps Device Status Report (DSR)
Ps = Status Report ("OK")
Ps = Report Cursor Position (CPR) [row;column] as r c
Ps Ps Set Scrolling Region [top;bottom] (default = full size of window) (DECSTBM)
Ps Request Terminal Parameters (DECREQTPARM)
Pm DEC Private Mode Set (DECSET)
Ps = Application Cursor Keys (DECCKM)
Ps = Designate USASCII for character sets G0-G3. (In the VT102, this selects
VT52 mode (DECANM), which xterm doesn't support.)
Ps = 132 Column Mode (DECCOLM)
Ps = Smooth (Slow) Scroll (DECSCLM)
Ps = Reverse Video (DECSCNM)
Ps = Origin Mode (DECOM)
Ps = Wraparound Mode (DECAWM)
Ps = Auto-repeat Keys (DECARM)
Ps = Send Mouse X & Y on button press. See the section Mouse Tracking.
Ps = Enter Tektronix Mode (DECTEK)
Ps = Allow 80 132 Mode
Ps = curses(5) fix
Ps = Turn On Margin Bell
Ps = Reverse-wraparound Mode
Ps = Start Logging
Ps = Use Alternate Screen Buffer (unless disabled by the titeInhibit resource)
Ps = Send Mouse X & Y on button press and release. See the section Mouse Tracking.
Ps = Use Hilite Mouse Tracking. See the section Mouse Tracking.

Home

Pm DEC Private Mode Reset (DECRST)
Ps = Normal Cursor Keys (DECCKM)
Ps = 80 Column Mode (DECCOLM)
Ps = Jump (Fast) Scroll (DECSCLM)
Ps = Normal Video (DECSCNM)
Ps = Normal Cursor Mode (DECOM)
Ps = No Wraparound Mode (DECAWM)
Ps = No Auto-repeat Keys (DECARM)
Ps = Don't Send Mouse X & Y on button press
Ps = Disallow 80 132 Mode
Ps = No >curses(5) fix
Ps = Turn Off Margin Bell
Ps = No Reverse-wraparound Mode
Ps = Stop Logging
Ps = Use Normal Screen Buffer
Ps = Don't Send Mouse X & Y on button press and release
Ps = Don't Use Hilite Mouse Tracking
Pm Restore DEC Private Mode Values. The value of Ps previously saved is restored. Ps values are the same as for DECSET.
Pm Save DEC Private Mode Values. Psvalues are the same as for DECSET.
Ps Pt Set Text Parameters
Ps = Change Icon Name and Window Title to Pt
Ps = Change Icon Name to Pt
Ps = Change Window Title to Pt
Ps = Change Log File to Pt (normally disabled by a compile-time option)
Ps = Set Font to Pt
Pt Privacy Message (PM)
xterm implements no PM functions; Pt is ignored. Pt need not be printable characters.
Pt Application Program Command (APC)
xterm implements no APC functions; Pt is ignored. Pt need not be printable characters.
Full Reset (RIS)
Select the G2 Character Set (LS2)
Select the G3 Character Set (LS3)
Invoke the G3 Character Set as GR (LS3R). Has no visible effect in xterm
Invoke the G2 Character Set as GR (LS2R). Has no visible effect in xterm.
Invoke the G1 Character Set as GR (LS1R). Has no visible effect in xterm

Home

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 1based.

X10 compatibility mode sends an escape sequence on button press encoding the location and the mouse button pressed. It is enabled by specifying parameter 9 to DECSET. On button press, xterm sends CbCxCy(6 characters). 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 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 modifiers 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. Warning: we 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:

Ps Ps Ps PsPs .

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: CxCy. If either coordinate is past the end of the line: CxCyCxCyCxCy. The parameters are startx, starly, 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 location of the mouse at button up, which may not be over a character.

Home

Tektronix 4014 Mode
Most of these sequences are standard Tektronix 4014 control sequences. The major features missing are the writethru 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.
Bell (Ctrl-G)
Backspace (Ctrl-H)
Horizontal Tab (Ctrl-I)
Line Feed or New Line (Ctrl-J)
Cursor up (Ctrl-K)
Form Feed or New Page (Ctrl-L)
Carriage Retwn (Ctrl-M)
Switch to VT100 Mode (ESC Ctrl-C)
Retwn Terminal Status (ESC Ctrl-E)
PAGE (Clear Screen)
Begin 4015 APL mode (ignored by xterm)(ESC Ctrl-N)
End 4015 APL mode (ignored by xterm)(ESC Ctrl-O)
COPY (Save Tektronix Codes to file COPYyy-mm-dd.hh:mm:ss) (ESC Ctrl-W)
Bypass Condition (ESC Clrl-X)
GIN mode (ESC Ctrl-Z)
Special Point Plot Mode (ESC Ctrl-)
Select Large Character Set
Select #2 Character Set
Select #3 Character Set
Select Small Character Set
Ps Pt Set Text Parameters of VT window
Ps = Change Icon Name and Window Title to Pt
Ps = Change Icon Name to Pt
Ps = Change Window Title to Pt
Ps = Change Log File to Pt
Norrnal Z Axis and Normal (solid) Vectors
Normal Z Axis and Dotted Line Vectors
Normal Z Axis and Dot-Dashed Vectors
Normal Z Axis and Short-Dashed Vectors
Normal Z Axis and Long-Dashed Vectors
Defocused Z Axis and Normal (solid) Vectors
Defocused Z Axis and Dotted Line Vectors
Defocused Z Axis and Dot-Dashed Vectors
Defocused Z Axis and Short-Dashed Vectors
Defocused Z Axis and Long-Dashed Vectors
Write-Thru Mode and Normal (solid) Vectors
Write-Thru Mode and Dotted Line Vectors
Write-Thru Mode and Dot-Dashed Vectors
Write-Thru Mode and Short-Dashed Vectors
Write-Thru Mode and Long-Dashed Vectors
Point Plot Mode (Ctrl-)
Graph Mode (Ctrl-])
Incremental Plot Mode (Ctrl-^)
Alpha Mode (Ctrl-_)

Home

Contents Previous Chapter