








                        XXtteerrmm CCoonnttrrooll SSeeqquueenncceess

                               _E_d_w_a_r_d _M_o_y
                   University of California, Berkeley

                               Revised by

                             _S_t_e_p_h_e_n _G_i_l_d_e_a
                          X Consortium (1994)

                             _T_h_o_m_a_s _D_i_c_k_e_y
                      XFree86 Project (1996-2004)



DDeeffiinniittiioonnss

_c    The literal character _c.

_C    A single (required) character.

_P_s   A single (usually optional) numeric parameter, composed of one of
     more digits.

_P_m   A multiple numeric parameter composed of any number of single
     numeric parameters, separated by ;  character(s).  Individual val-
     ues for the parameters are listed with _P_s .

_P_t   A text parameter composed of printable characters.

CC11 ((88--BBiitt)) CCoonnttrrooll CChhaarraacctteerrss

The _x_t_e_r_m program recognizes both 8-bit and 7-bit control characters.
It generates 7-bit controls (by default) or 8-bit if S8C1T is enabled.
The following pairs of 7-bit and 8-bit control characters are equiva-
lent:

ESC D
     Index (IND  is 0x84)
ESC E
     Next Line (NEL  is 0x85)
ESC H
     Tab Set (HTS  is 0x88)
ESC M
     Reverse Index (RI  is 0x8d)
ESC N
     Single Shift Select of G2 Character Set (SS2  is 0x8e): affects
     next character only
ESC O
     Single Shift Select of G3 Character Set (SS3  is 0x8f): affects
     next character only
ESC P
     Device Control String (DCS  is 0x90)
ESC V
     Start of Guarded Area (SPA  is 0x96)
ESC W
     End of Guarded Area (EPA  is 0x97)
ESC X
     Start of String (SOS  is 0x98)
ESC Z
     Return Terminal ID (DECID is 0x9a).  Obsolete form of CSI c  (DA).
ESC [
     Control Sequence Introducer (CSI  is 0x9b)
ESC \
     String Terminator (ST  is 0x9c)
ESC ]
     Operating System Command (OSC  is 0x9d)
ESC ^
     Privacy Message (PM  is 0x9e)
ESC _
     Application Program Command (APC  is 0x9f)

These control characters are used in the vtXXX emulation.

VVTT110000 MMooddee
Most of these control sequences are standard VT102 control sequences,
but there is support for later DEC VT terminals (i.e., VT220, VT320,
VT420), as well as ISO 6429 and _a_i_x_t_e_r_m color controls.  The only VT102
features not supported is auto-repeat, since the only way X provides for
this will affect all windows.  There are additional control sequences to
provide _x_t_e_r_m_-dependent functions, such as 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 dis-
cussion of character sets.

SSiinnggllee--cchhaarraacctteerr ffuunnccttiioonnss
BEL            Bell (Ctrl-G)
BS             Backspace (Ctrl-H)
CR             Carriage Return (Ctrl-M)
ENQ            Return Terminal Status (Ctrl-E).  Default response is an
               empty string, but may be overridden by a resource aannsswweerr--
               bbaacckkSSttrriinngg.
FF             Form Feed or New Page (NP) (Ctrl-L) same as LF
LF             Line Feed or New Line (NL) (Ctrl-J)
SO             Shift Out (Ctrl-N) -> Switch to Alternate Character Set:
               invokes the G1 character set.
SP             Space.
TAB            Horizontal Tab (HT) (Ctrl-I)
VT             Vertical Tab (Ctrl-K) same as LF
SI             Shift In (Ctrl-O) -> Switch to Standard Character Set:
               invokes the G0 character set (the default).

CCoonnttrroollss bbeeggiinnnniinngg wwiitthh EESSCC ((ootthheerr tthhaann tthhoossee wwhheerree EESSCC iiss ppaarrtt ooff aa
77--bbiitt eeqquuiivvaalleenntt ttoo 88--bbiitt CC11 ccoonnttrroollss)),, oorrddeerreedd bbyy tthhee ffiinnaall cchhaarraacc--
tteerr((ss))..
ESC SP F       7-bit controls (S7C1T).
ESC SP G       8-bit controls (S8C1T).
ESC SP L       Set ANSI conformance level 1 (dpANS X3.134.1).
ESC SP M       Set ANSI conformance level 2 (dpANS X3.134.1).
ESC SP N       Set ANSI conformance level 3 (dpANS X3.134.1).
ESC # 3        DEC double-height line, top half (DECDHL)
ESC # 4        DEC double-height line, bottom half (DECDHL)
ESC # 5        DEC single-width line (DECSWL)
ESC # 6        DEC double-width line (DECDWL)
ESC # 8        DEC Screen Alignment Test (DECALN)
ESC % @        Select default character set, ISO 8859-1 (ISO 2022)
ESC % G        Select UTF-8 character set (ISO 2022)
ESC ( _C        Designate G0 Character Set (ISO 2022)
ESC ) _C        Designate G1 Character Set (ISO 2022)
ESC * _C        Designate G2 Character Set (ISO 2022)
ESC + _C        Designate G3 Character Set (ISO 2022)
               Final character _C for designating character sets (0 , A
               and B  apply to VT100 and up, the remainder to VT220 and
               up):
                 _C = 0  -> DEC Special Character and Line Drawing Set
                 _C = A  -> United Kingdom (UK)
                 _C = B  -> United States (USASCII)
                 _C = 4  -> Dutch
                 _C = C  or 5  -> Finnish
                 _C = R  -> French
                 _C = Q  -> French Canadian
                 _C = K  -> German
                 _C = Y  -> Italian
                 _C = E  or 6  -> Norwegian/Danish
                 _C = Z  -> Spanish
                 _C = H  or 7  -> Swedish
                 _C = =  -> Swiss
ESC 7          Save Cursor (DECSC)
ESC 8          Restore Cursor (DECRC)
ESC =          Application Keypad (DECPAM)
ESC >          Normal Keypad (DECPNM)
ESC F          Cursor to lower left corner of screen (if enabled by the
               hhppLLoowweerrlleeffttBBuuggCCoommppaatt resource).
ESC c          Full Reset (RIS)
ESC l          Memory Lock (per HP terminals).  Locks memory above the
               cursor.
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 _x_t_e_r_m.
ESC }          Invoke the G2 Character Set as GR (LS2R).  Has no visible
               effect in _x_t_e_r_m.
ESC ~          Invoke the G1 Character Set as GR (LS1R).  Has no visible
               effect in _x_t_e_r_m.

AApppplliiccaattiioonn PPrrooggrraamm--CCoonnttrrooll ffuunnccttiioonnss
APC _P_t ST      _x_t_e_r_m implements no APC  functions; _P_t is ignored.  _P_t
               need not be printable characters.

DDeevviiccee--CCoonnttrrooll ffuunnccttiioonnss
DCS _P_s; _P_s| _P_t ST
               User-Defined Keys (DECUDK).  The first parameter:
                 _P_s = 0  -> Clear all UDK definitions before starting
               (default)
                 _P_s = 1  -> Erase Below (default)
               The second parameter:
                 _P_s = 0  -> Lock the keys (default)
                 _P_s = 1  -> Do not lock.
               The third parameter is a ';'-separated list of strings
               denoting the key-code separated by a '/' from the hex-
               encoded key value.  The key codes correspond to the DEC
               function-key codes (e.g., F6=17).
DCS $ q _P_t ST  Request Status String (DECRQSS).  The string following
               the "q" is one of the following:
                 " q     -> DECSCA
                 " p     -> DECSCL
                 r       -> DECSTBM
                 m       -> SGR
               _x_t_e_r_m responds with DCS 1 $ r _P_t ST for valid requests,
               replacing the _P_t with the corresponding CSI string, or
               DCS 0 $ r _P_t ST for invalid requests.
DCS + q _P_t ST  Request Termcap/Terminfo String (xterm, experimental).
               The string following the "q" is a list of names encoded
               in hexadecimal (2 digits per character) separated by ;
               which correspond to termcap or terminfo key names.
               _x_t_e_r_m responds with DCS 1 + r _P_t ST for valid requests,
               adding to _P_t an = , and the value of the corresponding
               string that xterm would send, or DCS 0 + r _P_t ST for
               invalid requests.  The strings are encoded in hexadecimal
               (2 digits per character).

FFuunnccttiioonnss uussiinngg CCSSII ,, oorrddeerreedd bbyy tthhee ffiinnaall cchhaarraacctteerr((ss))
CSI _P_s @       Insert _P_s (Blank) Character(s) (default = 1) (ICH)
CSI _P_s A       Cursor Up _P_s Times (default = 1) (CUU)
CSI _P_s B       Cursor Down _P_s Times (default = 1) (CUD)
CSI _P_s C       Cursor Forward _P_s Times (default = 1) (CUF)
CSI _P_s D       Cursor Backward _P_s Times (default = 1) (CUB)
CSI _P_s E       Cursor Next Line _P_s Times (default = 1) (CNL)
CSI _P_s F       Cursor Preceding Line _P_s Times (default = 1) (CPL)
CSI _P_s G       Cursor Character Absolute  [column] (default = [row,1])
               (CHA)
CSI _P_s ; _P_s H  Cursor Position [row;column] (default = [1,1]) (CUP)
CSI _P_s I       Cursor Forward Tabulation _P_s tab stops (default = 1)
               (CHT)
CSI _P_s J       Erase in Display (ED)
                 _P_s = 0  -> Erase Below (default)
                 _P_s = 1  -> Erase Above
                 _P_s = 2  -> Erase All
                 _P_s = 3  -> Erase Saved Lines (xterm)
CSI ? _P_s J     Erase in Display (DECSED)
                 _P_s = 0  -> Selective Erase Below (default)
                 _P_s = 1  -> Selective Erase Above
                 _P_s = 2  -> Selective Erase All
CSI _P_s K       Erase in Line (EL)
                 _P_s = 0  -> Erase to Right (default)
                 _P_s = 1  -> Erase to Left
                 _P_s = 2  -> Erase All
CSI ? _P_s K     Erase in Line (DECSEL)
                 _P_s = 0  -> Selective Erase to Right (default)
                 _P_s = 1  -> Selective Erase to Left
                 _P_s = 2  -> Selective Erase All
CSI _P_s L       Insert _P_s Line(s) (default = 1) (IL)
CSI _P_s M       Delete _P_s Line(s) (default = 1) (DL)
CSI _P_s P       Delete _P_s Character(s) (default = 1) (DCH)
CSI _P_s S       Scroll up _P_s lines (default = 1) (SU)
CSI _P_s T       Scroll down _P_s lines (default = 1) (SD)
CSI _P_s ; _P_s ; _P_s ; _P_s ; _P_s T
               Initiate hilite mouse tracking.  Parameters are
               [func;startx;starty;firstrow;lastrow].  See the section
               MMoouussee TTrraacckkiinngg.
CSI _P_s X       Erase _P_s Character(s) (default = 1) (ECH)
CSI _P_s Z       Cursor Backward Tabulation _P_s tab stops (default = 1)
               (CBT)
CSI _P_m `       Character Position Absolute  [column] (default = [row,1])
               (HPA)
CSI _P_s b       Repeat the preceding graphic character _P_s times (REP)
CSI _P_s c       Send Device Attributes (Primary DA)
                 _P_s = 0 , 1 or omitted -> request attributes from termi-
               nal.  The response depends on the ddeeccTTeerrmmiinnaallIIDD resource
               setting.
                 -> CSI ? 1 ; 2 c  (``VT100 with Advanced Video
               Option'')
                 -> CSI ? 1 ; 0 c  (``VT101 with No Options'')
                 -> CSI ? 6 c  (``VT102'')
                 -> CSI ? 6 0 ; 1 ; 2 ; 6 ; 8 ; 9 ; 1 5 ; c  (``VT220'')
               The VT100-style response parameters do not mean anything
               by themselves.  VT220 parameters do, telling the host
               what features the terminal supports:
                 -> 1  132-columns
                 -> 2  Printer
                 -> 6  Selective erase
                 -> 8  User-defined keys
                 -> 9  National replacement character sets
                 -> 1 5  Technical characters
                 -> 2 2  ANSI color, e.g., VT525
                 -> 2 9  ANSI text locator (i.e., DEC Locator mode)
CSI > _P_s c     Send Device Attributes (Secondary DA)
                 _P_s = 0 , 1 or omitted -> request the terminal's identi-
               fication code.  The response depends on the ddeeccTTeerrmmiinnaallIIDD
               resource setting.  It should apply only to VT220 and up,
               but _x_t_e_r_m extends this to VT100.
                 -> CSI  > _P_p ; _P_v ; _P_c c
               where _P_p denotes the terminal type
                 -> 0  (``VT100'')
                 -> 1  (``VT220'')
               and _P_v is the firmware version (for _x_t_e_r_m, this is the
               XFree86 patch number, starting with 95).  In a DEC termi-
               nal, _P_c indicates the ROM cartridge registration number
               and is always zero.
CSI _P_m d       Line Position Absolute  [row] (default = [1,column])
               (VPA)
CSI _P_s ; _P_s f  Horizontal and Vertical Position [row;column] (default =
               [1,1]) (HVP)
CSI _P_s g       Tab Clear (TBC)
                 _P_s = 0  -> Clear Current Column (default)
                 _P_s = 3  -> Clear All
CSI _P_m h       Set Mode (SM)
                 _P_s = 2  -> Keyboard Action Mode (AM)
                 _P_s = 4  -> Insert Mode (IRM)
                 _P_s = 1 2  -> Send/receive (SRM)
                 _P_s = 2 0  -> Automatic Newline (LNM)
CSI ? _P_m h     DEC Private Mode Set (DECSET)
                 _P_s = 1  -> Application Cursor Keys (DECCKM)
                 _P_s = 2  -> Designate USASCII for character sets G0-G3
               (DECANM), and set VT100 mode.
                 _P_s = 3  -> 132 Column Mode (DECCOLM)
                 _P_s = 4  -> Smooth (Slow) Scroll (DECSCLM)
                 _P_s = 5  -> Reverse Video (DECSCNM)
                 _P_s = 6  -> Origin Mode (DECOM)
                 _P_s = 7  -> Wraparound Mode (DECAWM)
                 _P_s = 8  -> Auto-repeat Keys (DECARM)
                 _P_s = 9  -> Send Mouse X & Y on button press.  See the
               section MMoouussee TTrraacckkiinngg.
                 _P_s = 1 0  -> Show toolbar (rxvt)
                 _P_s = 1 2  -> Start Blinking Cursor (att610)
                 _P_s = 1 8  -> Print form feed (DECPFF)
                 _P_s = 1 9  -> Set print extent to full screen (DECPEX)
                 _P_s = 2 5  -> Show Cursor (DECTCEM)
                 _P_s = 3 0  -> Show scrollbar (rxvt).
                 _P_s = 3 5  -> Enable font-shifting functions (rxvt).
                 _P_s = 3 8  -> Enter Tektronix Mode (DECTEK)
                 _P_s = 4 0  -> Allow 80 <--> 132 Mode
                 _P_s = 4 1  -> _m_o_r_e(1) fix (see ccuurrsseess resource)
                 _P_s = 4 2  -> Enable Nation Replacement Character sets
               (DECNRCM)
                 _P_s = 4 4  -> Turn On Margin Bell
                 _P_s = 4 5  -> Reverse-wraparound Mode
                 _P_s = 4 6  -> Start Logging (normally disabled by a com-
               pile-time option)
                 _P_s = 4 7  -> Use Alternate Screen Buffer (unless dis-
               abled by the ttiitteeIInnhhiibbiitt resource)
                 _P_s = 6 6  -> Application keypad (DECNKM)
                 _P_s = 6 7  -> Backarrow key sends delete (DECBKM)
                 _P_s = 1 0 0 0  -> Send Mouse X & Y on button press and
               release.  See the section MMoouussee TTrraacckkiinngg.
                 _P_s = 1 0 0 1  -> Use Hilite Mouse Tracking.
                 _P_s = 1 0 0 2  -> Use Cell Motion Mouse Tracking.
                 _P_s = 1 0 0 3  -> Use All Motion Mouse Tracking.
                 _P_s = 1 0 1 0  -> Scroll to bottom on tty output (rxvt).
                 _P_s = 1 0 1 1  -> Scroll to bottom on key press (rxvt).
                 _P_s = 1 0 3 5  -> Enable special modifiers for Alt and
               NumLock keys.
                 _P_s = 1 0 3 6  -> Send ESC when Meta modifies a key
               (enables the mmeettaaSSeennddssEEssccaappee resource).
                 _P_s = 1 0 3 7  -> Send DEL from the editing-keypad
               Delete key
                 _P_s = 1 0 4 7  -> Use Alternate Screen Buffer (unless
               disabled by the ttiitteeIInnhhiibbiitt resource)
                 _P_s = 1 0 4 8  -> Save cursor as in DECSC (unless dis-
               abled by the ttiitteeIInnhhiibbiitt resource)
                 _P_s = 1 0 4 9  -> Save cursor as in DECSC and use Alter-
               nate Screen Buffer, clearing it first (unless disabled by
               the ttiitteeIInnhhiibbiitt resource).  This combines the effects of
               the 1 0 4 7  and 1 0 4 8  modes.  Use this with terminfo-
               based applications rather than the 4 7  mode.
                 _P_s = 1 0 5 1  -> Set Sun function-key mode.
                 _P_s = 1 0 5 2  -> Set HP function-key mode.
                 _P_s = 1 0 5 3  -> Set SCO function-key mode.
                 _P_s = 1 0 6 0  -> Set legacy keyboard emulation (X11R6).
                 _P_s = 1 0 6 1  -> Set Sun/PC keyboard emulation of VT220
               keyboard.
CSI _P_m i       Media Copy (MC)
                 _P_s = 0  -> Print screen (default)
                 _P_s = 4  -> Turn off printer controller mode
                 _P_s = 5  -> Turn on printer controller mode
CSI ? _P_m i     Media Copy (MC, DEC-specific)
                 _P_s = 1  -> Print line containing cursor
                 _P_s = 4  -> Turn off autoprint mode
                 _P_s = 5  -> Turn on autoprint mode
                 _P_s = 1  0  -> Print composed display, ignores DECPEX
                 _P_s = 1  1  -> Print all pages
CSI _P_m l       Reset Mode (RM)
                 _P_s = 2  -> Keyboard Action Mode (AM)
                 _P_s = 4  -> Replace Mode (IRM)
                 _P_s = 1 2  -> Send/receive (SRM)
                 _P_s = 2 0  -> Normal Linefeed (LNM)
CSI ? _P_m l     DEC Private Mode Reset (DECRST)
                 _P_s = 1  -> Normal Cursor Keys (DECCKM)
                 _P_s = 2  -> Designate VT52 mode (DECANM).
                 _P_s = 3  -> 80 Column Mode (DECCOLM)
                 _P_s = 4  -> Jump (Fast) Scroll (DECSCLM)
                 _P_s = 5  -> Normal Video (DECSCNM)
                 _P_s = 6  -> Normal Cursor Mode (DECOM)
                 _P_s = 7  -> No Wraparound Mode (DECAWM)
                 _P_s = 8  -> No Auto-repeat Keys (DECARM)
                 _P_s = 9  -> Don't Send Mouse X & Y on button press
                 _P_s = 1 0  -> Hide toolbar (rxvt)
                 _P_s = 1 2  -> Stop Blinking Cursor (att610)
                 _P_s = 1 8  -> Don't print form feed (DECPFF)
                 _P_s = 1 9  -> Limit print to scrolling region (DECPEX)
                 _P_s = 2 5  -> Hide Cursor (DECTCEM)
                 _P_s = 3 0  -> Don't show scrollbar (rxvt).
                 _P_s = 3 5  -> Disable font-shifting functions (rxvt).
                 _P_s = 4 0  -> Disallow 80 <--> 132 Mode
                 _P_s = 4 1  -> No _m_o_r_e(1) fix (see ccuurrsseess resource)
                 _P_s = 4 2  -> Disable Nation Replacement Character sets
               (DECNRCM)
                 _P_s = 4 4  -> Turn Off Margin Bell
                 _P_s = 4 5  -> No Reverse-wraparound Mode
                 _P_s = 4 6  -> Stop Logging (normally disabled by a com-
               pile-time option)
                 _P_s = 4 7  -> Use Normal Screen Buffer
                 _P_s = 6 6  -> Numeric keypad (DECNKM)
                 _P_s = 6 7  -> Backarrow key sends backspace (DECBKM)
                 _P_s = 1 0 0 0  -> Don't Send Mouse X & Y on button press
               and release.  See the section MMoouussee TTrraacckkiinngg.
                 _P_s = 1 0 0 1  -> Don't Use Hilite Mouse Tracking
                 _P_s = 1 0 0 2  -> Don't Use Cell Motion Mouse Tracking
                 _P_s = 1 0 0 3  -> Don't Use All Motion Mouse Tracking
                 _P_s = 1 0 1 0  -> Don't scroll to bottom on tty output
               (rxvt).
                 _P_s = 1 0 1 1  -> Don't scroll to bottom on key press
               (rxvt).
                 _P_s = 1 0 3 5  -> Disable special modifiers for Alt and
               NumLock keys.
                 _P_s = 1 0 3 6  -> Don't send ESC when Meta modifies a
               key (disables the mmeettaaSSeennddssEEssccaappee resource).
                 _P_s = 1 0 3 7  -> Send VT220 Remove from the editing-
               keypad Delete key
                 _P_s = 1 0 4 7  -> Use Normal Screen Buffer, clearing
               screen first if in the Alternate Screen (unless disabled
               by the ttiitteeIInnhhiibbiitt resource)
                 _P_s = 1 0 4 8  -> Restore cursor as in DECRC (unless
               disabled by the ttiitteeIInnhhiibbiitt resource)
                 _P_s = 1 0 4 9  -> Use Normal Screen Buffer and restore
               cursor as in DECRC (unless disabled by the ttiitteeIInnhhiibbiitt
               resource).  This combines the effects of the 1 0 4 7  and
               1 0 4 8  modes.  Use this with terminfo-based applica-
               tions rather than the 4 7  mode.
                 _P_s = 1 0 5 1  -> Reset Sun function-key mode.
                 _P_s = 1 0 5 2  -> Reset HP function-key mode.
                 _P_s = 1 0 5 3  -> Reset SCO function-key mode.
                 _P_s = 1 0 6 0  -> Reset legacy keyboard emulation
               (X11R6).
                 _P_s = 1 0 6 1  -> Reset Sun/PC keyboard emulation of
               VT220 keyboard.
CSI _P_m m       Character Attributes (SGR)
                 _P_s = 0  -> Normal (default)
                 _P_s = 1  -> Bold
                 _P_s = 4  -> Underlined
                 _P_s = 5  -> Blink (appears as Bold)
                 _P_s = 7  -> Inverse
                 _P_s = 8  -> Invisible, i.e., hidden (VT300)
                 _P_s = 2 2  -> Normal (neither bold nor faint)
                 _P_s = 2 4  -> Not underlined
                 _P_s = 2 5  -> Steady (not blinking)
                 _P_s = 2 7  -> Positive (not inverse)
                 _P_s = 2 8  -> Visible, i.e., not hidden (VT300)
                 _P_s = 3 0  -> Set foreground color to Black
                 _P_s = 3 1  -> Set foreground color to Red
                 _P_s = 3 2  -> Set foreground color to Green
                 _P_s = 3 3  -> Set foreground color to Yellow
                 _P_s = 3 4  -> Set foreground color to Blue
                 _P_s = 3 5  -> Set foreground color to Magenta
                 _P_s = 3 6  -> Set foreground color to Cyan
                 _P_s = 3 7  -> Set foreground color to White
                 _P_s = 3 9  -> Set foreground color to default (original)
                 _P_s = 4 0  -> Set background color to Black
                 _P_s = 4 1  -> Set background color to Red
                 _P_s = 4 2  -> Set background color to Green
                 _P_s = 4 3  -> Set background color to Yellow
                 _P_s = 4 4  -> Set background color to Blue
                 _P_s = 4 5  -> Set background color to Magenta
                 _P_s = 4 6  -> Set background color to Cyan
                 _P_s = 4 7  -> Set background color to White
                 _P_s = 4 9  -> Set background color to default (origi-
               nal).

               If 16-color support is compiled, the following apply.
               Assume that _x_t_e_r_m's resources are set so that the ISO
               color codes are the first 8 of a set of 16.  Then the
               _a_i_x_t_e_r_m colors are the bright versions of the ISO colors:
                 _P_s = 9 0  -> Set foreground color to Black
                 _P_s = 9 1  -> Set foreground color to Red
                 _P_s = 9 2  -> Set foreground color to Green
                 _P_s = 9 3  -> Set foreground color to Yellow
                 _P_s = 9 4  -> Set foreground color to Blue
                 _P_s = 9 5  -> Set foreground color to Magenta
                 _P_s = 9 6  -> Set foreground color to Cyan
                 _P_s = 9 7  -> Set foreground color to White
                 _P_s = 1 0 0  -> Set background color to Black
                 _P_s = 1 0 1  -> Set background color to Red
                 _P_s = 1 0 2  -> Set background color to Green
                 _P_s = 1 0 3  -> Set background color to Yellow
                 _P_s = 1 0 4  -> Set background color to Blue
                 _P_s = 1 0 5  -> Set background color to Magenta
                 _P_s = 1 0 6  -> Set background color to Cyan
                 _P_s = 1 0 7  -> Set background color to White

               If _x_t_e_r_m is compiled with the 16-color support disabled,
               it supports the following, from _r_x_v_t:
                 _P_s = 1 0 0  -> Set foreground and background color to
               default

               If 88- or 256-color support is compiled, the following
               apply.
                 _P_s = 3 8  ; 5  ; _P_s -> Set foreground color to the sec-
               ond _P_s
                 _P_s = 4 8  ; 5  ; _P_s -> Set background color to the sec-
               ond _P_s

CSI _P_s n       Device Status Report (DSR)
                 _P_s = 5  -> Status Report CSI 0 n  (``OK'')
                 _P_s = 6  -> Report Cursor Position (CPR) [row;column] as
               CSI _r ; _c R
CSI ? _P_s n     Device Status Report (DSR, DEC-specific)
                 _P_s = 6  -> Report Cursor Position (CPR) [row;column] as
               CSI ? _r ; _c R (assumes page is zero).
                 _P_s = 1 5  -> Report Printer status as CSI ? 1 0  n
               (ready) or CSI ? 1 1  n  (not ready)
                 _P_s = 2 5  -> Report UDK status as CSI ? 2 0  n
               (unlocked) or CSI ? 2 1  n  (locked)
                 _P_s = 2 6  -> Report Keyboard status as
               CSI ? 2 7  ;  1  ;  0  ;  0  n  (North American)
               The last two parameters apply to VT400 & up, and denote
               keyboard ready and LK01 respectively.
                 _P_s = 5 3  -> Report Locator status as
               CSI ? 5 3  n  Locator available, if compiled-in, or
               CSI ? 5 0  n  No Locator, if not.
CSI ! p        Soft terminal reset (DECSTR)
CSI _P_s ; _P_s " p
               Set conformance level (DECSCL) Valid values for the first
               parameter:
                 _P_s = 6 1  -> VT100
                 _P_s = 6 2  -> VT200
                 _P_s = 6 3  -> VT300
               Valid values for the second parameter:
                 _P_s = 0  -> 8-bit controls
                 _P_s = 1  -> 7-bit controls (always set for VT100)
                 _P_s = 2  -> 8-bit controls
CSI _P_s " q     Select character protection attribute (DECSCA).  Valid
               values for the parameter:
                 _P_s = 0  -> DECSED and DECSEL can erase (default)
                 _P_s = 1  -> DECSED and DECSEL cannot erase
                 _P_s = 2  -> DECSED and DECSEL can erase
CSI _P_s ; _P_s r  Set Scrolling Region [top;bottom] (default = full size of
               window) (DECSTBM)
CSI ? _P_m r     Restore DEC Private Mode Values.  The value of _P_s previ-
               ously saved is restored.  _P_s values are the same as for
               DECSET.
CSI _P_t; _P_l; _P_b; _P_r; _P_s$ r
               Change Attributes in Rectangular Area (DECCARA).
                 _P_t; _P_l; _P_b; _P_r denotes the rectangle.
                 _P_s denotes the SGR attributes to change: 0, 1, 4, 5, 7
CSI s          Save cursor (ANSI.SYS)
CSI ? _P_m s     Save DEC Private Mode Values.  _P_s values are the same as
               for DECSET.
CSI _P_s ; _P_s ; _P_s t
               Window manipulation (from _d_t_t_e_r_m, as well as extensions).
               Valid values for the first (and any additional parame-
               ters) are:
                 _P_s = 1  -> De-iconify window.
                 _P_s = 2  -> Iconify window.
                 _P_s = 3  ; _x _; _y -> Move window to [x, y].
                 _P_s = 4  ; _h_e_i_g_h_t _; _w_i_d_t_h -> Resize the _x_t_e_r_m window to
               height and width in pixels.
                 _P_s = 5  -> Raise the _x_t_e_r_m window to the front of the
               stacking order.
                 _P_s = 6  -> Lower the _x_t_e_r_m window to the bottom of the
               stacking order.
                 _P_s = 7  -> Refresh the _x_t_e_r_m window.
                 _P_s = 8  ; _h_e_i_g_h_t _; _w_i_d_t_h -> Resize the text area to
               [height;width] in characters.
                 _P_s = 9  ; 0  -> Restore maximized window.
                 _P_s = 9  ; 1  -> Maximize window (i.e., resize to screen
               size).
                 _P_s = 1 1  -> Report _x_t_e_r_m window state.  If the _x_t_e_r_m
               window is open (non-iconified), it returns CSI 1 t .  If
               the _x_t_e_r_m window is iconified, it returns CSI 2 t .
                 _P_s = 1 3  -> Report _x_t_e_r_m window position as CSI 3 ; _x;
               _yt
                 _P_s = 1 4  -> Report _x_t_e_r_m window in pixels as CSI  4  ;
               _h_e_i_g_h_t ;  _w_i_d_t_h t
                 _P_s = 1 8  -> Report the size of the text area in char-
               acters as CSI  8  ;  _h_e_i_g_h_t ;  _w_i_d_t_h t
                 _P_s = 1 9  -> Report the size of the screen in charac-
               ters as CSI  9  ;  _h_e_i_g_h_t ;  _w_i_d_t_h t
                 _P_s = 2 0  -> Report _x_t_e_r_m window's icon label as OSC  L
               _l_a_b_e_l ST
                 _P_s = 2 1  -> Report _x_t_e_r_m window's title as OSC  l
               _t_i_t_l_e ST
                 _P_s >= 2 4  -> Resize to _P_s lines (DECSLPP)
CSI _P_t; _P_l; _P_b; _P_r; _P_s$ t
               Reverse Attributes in Rectangular Area (DECRARA).
                 _P_t; _P_l; _P_b; _P_r denotes the rectangle.
                 _P_s denotes the attributes to reverse. 1, 4, 5, 7
CSI u          Save cursor (ANSI.SYS)
CSI _P_t; _P_l; _P_b; _P_r; _P_p; _P_t; _P_l; _P_p$ v
               Copy Rectangular Area (DECCRA)
                 _P_t; _P_l; _P_b; _P_r denotes the rectangle.
                 _P_p denotes the source page.
                 _P_t; _P_l denotes the target location.
                 _P_p denotes the target page.
CSI _P_t ; _P_l ; _P_b ; _P_r ' w
               Enable Filter Rectangle (DECEFR)
               Parameters are [top;left;bottom;right].
               Defines the coordinates of a filter rectangle and acti-
               vates it.  Anytime the locator is detected outside of the
               filter rectangle, an outside rectangle event is generated
               and the rectangle is disabled.  Filter rectangles are
               always treated as "one-shot" events.  Any parameters that
               are omitted default to the current locator position.  If
               all parameters are omitted, any locator motion will be
               reported.  DECELR always cancels any prevous rectangle
               definition.
CSI _P_s x       Request Terminal Parameters (DECREQTPARM)
               if _P_s is a "0" (default) or "1", and xxtteerrmm is emulating
               VT100, the control sequence elicits a response of the
               same form whose parameters describe the terminal:
                 _P_s -> the given _P_s incremented by 2.
                 1  -> no parity
                 1  -> eight bits
                 1  2  8  -> transmit 38.4k baud
                 1  2  8  -> receive 38.4k baud
                 1  -> clock multiplier
                 0  -> STP flags
CSI _P_s x       Select Attribute Change Extent (DECSACE).
                 _P_s = 0  -> from start to end position, wrapped
                 _P_s = 1  -> from start to end position, wrapped
                 _P_s = 2  -> rectangle (exact).
CSI _P_c; _P_t; _P_l; _P_b; _P_r$ x
               Fill Rectangular Area (DECFRA).
                 _P_c is the character to use.
                 _P_t; _P_l; _P_b; _P_r denotes the rectangle.
CSI _P_s ; _P_u ' z
               Enable Locator Reporting (DECELR)
               Valid values for the first parameter:
                 _P_s = 0  -> Locator disabled (default)
                 _P_s = 1  -> Locator enabled
                 _P_s = 2  -> Locator enabled for one report, then dis-
               abled
               The second parameter specifies the coordinate unit for
               locator reports.
               Valid values for the second parameter:
                 _P_u = 0  or omitted -> default to character cells
                 _P_u = 1  -> device physical pixels
                 _P_u = 2  -> character cells
CSI _P_t; _P_l; _P_b; _P_r$ z
               Erase Rectangular Area (DECERA).
                 _P_t; _P_l; _P_b; _P_r denotes the rectangle.
CSI _P_m ' {     Select Locator Events (DECSLE)
               Valid values for the first (and any additional parame-
               ters) are:
                 _P_s = 0  -> only respond to explicit host requests
               (DECRQLP)
                            (default) also cancels any filter rectangle
                 _P_s = 1  -> report button down transitions
                 _P_s = 2  -> do not report button down transitions
                 _P_s = 3  -> report button up transitions
                 _P_s = 4  -> do not report button up transitions
CSI _P_t; _P_l; _P_b; _P_r$ {
               Selective Erase Rectangular Area (DECSERA).
                 _P_t; _P_l; _P_b; _P_r denotes the rectangle.
CSI _P_s ' |     Request Locator Position (DECRQLP)
               Valid values for the parameter are:
                 _P_s = 0 , 1 or omitted -> transmit a single DECLRP loca-
               tor report

               If Locator Reporting has been enabled by a DECELR, xterm
               will respond with a DECLRP Locator Report.  This report
               is also generated on button up and down events if they
               have been enabled with a DECSLE, or when the locator is
               detected outside of a filter rectangle, if filter rectan-
               gles have been enabled with a DECEFR.

                 -> CSI _P_e ; _P_b ; _P_r ; _P_c ; _P_p &  w

               Parameters are [event;button;row;column;page].
               Valid values for the event:
                 _P_e = 0  -> locator unavailable - no other parameters
               sent
                 _P_e = 1  -> request - xterm received a DECRQLP
                 _P_e = 2  -> left button down
                 _P_e = 3  -> left button up
                 _P_e = 4  -> middle button down
                 _P_e = 5  -> middle button up
                 _P_e = 6  -> right button down
                 _P_e = 7  -> right button up
                 _P_e = 8  -> M4 button down
                 _P_e = 9  -> M4 button up
                 _P_e = 1 0  -> locator outside filter rectangle
               ``button'' parameter is a bitmask indicating which but-
               tons are pressed:
                 _P_b = 0  -> no buttons down
                 _P_b & 1  -> right button down
                 _P_b & 2  -> middle button down
                 _P_b & 4  -> left button down
                 _P_b & 8  -> M4 button down
               ``row'' and ``column'' parameters are the coordinates of
               the locator position in the xterm window, encoded as
               ASCII decimal.
               The ``page'' parameter is not used by xterm, and will be
               omitted.

OOppeerraattiinngg SSyysstteemm CCoonnttrroollss
OSC _P_s ; _P_t ST
OSC _P_s ; _P_t BEL
               Set Text Parameters.  For colors and font, if _P_t is a
               "?", the control sequence elicits a response which con-
               sists of the control sequence which would set the corre-
               sponding value.  The _d_t_t_e_r_m control sequences allow you
               to determine the icon name and window title.
                 _P_s = 0  -> Change Icon Name and Window Title to _P_t
                 _P_s = 1  -> Change Icon Name to _P_t
                 _P_s = 2  -> Change Window Title to _P_t
                 _P_s = 3  -> Set X property on top-level window. _P_t
               should be in the form "_p_r_o_p_=_v_a_l_u_e", or just "_p_r_o_p" to
               delete the property
                 _P_s = 4  ; _c _; _s_p_e_c -> Change Color Number _c to the
               color specified by _s_p_e_c, i.e., a name or RGB specifica-
               tion as per _X_P_a_r_s_e_C_o_l_o_r.  Any number of _c _n_a_m_e pairs may
               be given.  The color numbers correspond to the ANSI col-
               ors 0-7, their bright versions 8-15, and if supported,
               the remainder of the 88-color or 256-color table.

               If a "?" is given rather than a name or RGB specifica-
               tion, xterm replies with a control sequence of the same
               form which can be used to set the corresponding color.
               Because more than one pair of color number and specifica-
               tion can be given in one control sequence, xxtteerrmm can make
               more than one reply.

               The 8 colors which may be set using 1 0  through 1 7  are
               denoted _d_y_n_a_m_i_c _c_o_l_o_r_s, since the corresponding control
               sequences were the first means for setting xxtteerrmm's colors
               dynamically, i.e., after it was started.  They are not
               the same as the ANSI colors.  One or more parameters is
               expected for _P_t.  Each succesive parameter changes the
               next color in the list.  The value of _P_s tells the start-
               ing point in the list.  The colors are specified by name
               or RGB specification as per _X_P_a_r_s_e_C_o_l_o_r.

               If a "?" is given rather than a name or RGB specifica-
               tion, xterm replies with a control sequence of the same
               form which can be used to set the corresponding dynamic
               color.  Because more than one pair of color number and
               specification can be given in one control sequence, xxtteerrmm
               can make more than one reply.

                 _P_s = 1 0  -> Change VT100 text foreground color to _P_t
                 _P_s = 1 1  -> Change VT100 text background color to _P_t
                 _P_s = 1 2  -> Change text cursor color to _P_t
                 _P_s = 1 3  -> Change mouse foreground color to _P_t
                 _P_s = 1 4  -> Change mouse background color to _P_t
                 _P_s = 1 5  -> Change Tektronix foreground color to _P_t
                 _P_s = 1 6  -> Change Tektronix background color to _P_t
                 _P_s = 1 7  -> Change highlight color to _P_t
                 _P_s = 1 8  -> Change Tektronix cursor color to _P_t

                 _P_s = 4 6  -> Change Log File to _P_t (normally disabled
               by a compile-time option)
                 _P_s = 5 0  -> Set Font to _P_t If _P_t begins with a "#",
               index in the font menu, relative (if the next character
               is a plus or minus sign) or absolute.  A number is
               expected but not required after the sign (the default is
               the current entry for relative, zero for absolute index-
               ing).

PPrriivvaaccyy MMeessssaaggee
PM _P_t ST       _x_t_e_r_m implements no PM  functions; _P_t is ignored.  _P_t
               need not be printable characters.

PPCC--SSttyyllee FFuunnccttiioonn KKeeyyss
If _x_t_e_r_m does minimal translation of the function keys, it usually does
this with a PC-style keyboard, so PC-style function keys result.  Sun
keyboards are similar to PC keyboards.  Both have cursor and scrolling
operations printed on the keypad, which duplicate the smaller cursor and
scrolling keypads.
X does not predefine NumLock (used for VT220 keyboards) or Alt (used as
an extension for the Sun/PC keyboards) as modifiers.  These keys are
recognized as modifiers when enabled by the nnuummLLoocckk resource, or by the
DECSET 1 0 3 5  control sequence.
The cursor keys transmit the following escape sequences depending on the
mode specified via the DDEECCCCKKMM escape sequence.

                      KKeeyy         NNoorrmmaall    AApppplliiccaattiioonn
                  --------------------------------------
                  CCuurrssoorr UUpp      CCSSII AA      SSSS33 AA
                  CCuurrssoorr DDoowwnn    CCSSII BB      SSSS33 BB
                  CCuurrssoorr RRiigghhtt   CCSSII CC      SSSS33 CC
                  CCuurrssoorr LLeefftt    CCSSII DD      SSSS33 DD
                  --------------------------------------

The home- and end-keys (unlike PageUp and other keys also on the 6-key
editing keypad) are considered "cursor keys" by _x_t_e_r_m.  Their mode is
also controlled by the DDEECCCCKKMM escape sequence:

                      KKeeyy       NNoorrmmaall    AApppplliiccaattiioonn
                    ----------------------------------
                    HHoommee       CCSSII HH      SSSS33 HH
                    EEnndd        CCSSII FF      SSSS33 FF
                    ----------------------------------

The application keypad transmits the following escape sequences depend-
ing on the mode specified via the DDEECCPPNNMM and DDEECCPPAAMM escape sequences.
Use the NumLock key to override the application mode.
Not all keys are present on the Sun/PC keypad (e.g., PF1, Tab), but are
supported by the program.

           KKeeyy         NNuummeerriicc    AApppplliiccaattiioonn   TTeerrmmiinnffoo   TTeerrmmccaapp
      --------------------------------------------------------------
      SSppaaccee            SSPP         SSSS33 SSPP        --          --
      TTaabb              TTAABB        SSSS33 II         --          --
      EEnntteerr            CCRR         SSSS33 MM         kkeenntt       @@88
      PPFF11              SSSS33 PP      SSSS33 PP         kkff11        kk11
      PPFF22              SSSS33 QQ      SSSS33 QQ         kkff22        kk22
      PPFF33              SSSS33 RR      SSSS33 RR         kkff33        kk33
      PPFF44              SSSS33 SS      SSSS33 SS         kkff44        kk44
      ** (multiply)     **          SSSS33 jj         --          --
      ++ (add)          ++          SSSS33 kk         --          --
      ,, (comma)        ,,          SSSS33 ll         --          --
      -- (minus)        --          SSSS33 mm         --          --
      .. (Delete)       ..          CCSSII 33 ~~       --          --
      // (divide)       //          SSSS33 oo         --          --
      00 (Insert)       00          CCSSII 22 ~~       --          --
      11 (End)          11          SSSS33 FF         kkcc11        KK44
      22 (DownArrow)    22          CCSSII BB         --          --
      33 (PageDown)     33          CCSSII 66 ~~       kkcc33        KK55
      44 (LeftArrow)    44          CCSSII DD         --          --
      55 (Begin)        55          CCSSII EE         kkbb22        KK22
      66 (RightArrow)   66          CCSSII CC         --          --
      77 (Home)         77          SSSS33 HH         kkaa11        KK11
      88 (UpArrow)      88          CCSSII AA         --          --
      99 (PageUp)       99          CCSSII 55 ~~       kkaa33        KK33
      == ((eeqquuaall))        ==          SSSS33 XX         --          --
      --------------------------------------------------------------

They also provide 12 function keys, as well as a few other special-pur-
pose keys.

                         KKeeyy      EEssccaappee SSeeqquueennccee
                       ---------------------------
                       FF11         SSSS33 PP
                       FF22         SSSS33 QQ
                       FF33         SSSS33 RR
                       FF44         SSSS33 SS
                       FF55         CCSSII 11 55 ~~
                       FF66         CCSSII 11 77 ~~
                       FF77         CCSSII 11 88 ~~
                       FF88         CCSSII 11 99 ~~
                       FF99         CCSSII 22 00 ~~
                       FF1100        CCSSII 22 11 ~~
                       FF1111        CCSSII 22 33 ~~
                       FF1122        CCSSII 22 44 ~~
                       ---------------------------

Older versions of _x_t_e_r_m implement different escape sequences for F1
through F4.  These can be activated by setting the oollddXXtteerrmmFFKKeeyyss
resource.  However, since they do not correspond to any hardware termi-
nal, they have been deprecated.  (The DEC VT220 reserves F1 through F5
for local functions such as SSeettuupp).

                         KKeeyy      EEssccaappee SSeeqquueennccee
                       ---------------------------
                       FF11         CCSSII 11 11 ~~
                       FF22         CCSSII 11 22 ~~
                       FF33         CCSSII 11 33 ~~
                       FF44         CCSSII 11 44 ~~
                       ---------------------------

In normal mode, i.e., a Sun/PC keyboard when the ssuunnKKeeyybbooaarrdd resource is
false, _x_t_e_r_m recognizes function key modifiers which are parameters
appended before the final character of the control sequence.

                      CCooddee     MMooddiiffiieerrss
                    ---------------------------------
                       22       SShhiifftt
                       33       AAlltt
                       44       SShhiifftt ++ AAlltt
                       55       CCoonnttrrooll
                       66       SShhiifftt ++ CCoonnttrrooll
                       77       AAlltt ++ CCoonnttrrooll
                       88       SShhiifftt ++ AAlltt ++ CCoonnttrrooll
                    ---------------------------------

For example, shift-F5 would be sent as CSI 1 5 ; 2 ~

If the aallwwaayyssUUsseeMMooddss resource is set, the Meta modifier also is recog-
nized, making parameters 9 through 16.

VVTT222200--SSttyyllee FFuunnccttiioonn KKeeyyss
However, _x_t_e_r_m is most useful as a DEC VT102 or VT220 emulator.  Set the
ssuunnKKeeyybbooaarrdd resource to true to force a Sun/PC keyboard to act like a
VT220 keyboard.
The VT102/VT220 application keypad transmits unique escape sequences in
application mode, which are distinct from the cursor and scrolling key-
pad:

                      KKeeyy        NNuummeerriicc    AApppplliiccaattiioonn
                  --------------------------------------
                  SSppaaccee          SSPP         SSSS33 SSPP
                  TTaabb            TTAABB        SSSS33 II
                  EEnntteerr          CCRR         SSSS33 MM
                  PPFF11            SSSS33 PP      SSSS33 PP
                  PPFF22            SSSS33 QQ      SSSS33 QQ
                  PPFF33            SSSS33 RR      SSSS33 RR
                  PPFF44            SSSS33 SS      SSSS33 SS
                  ** (multiply)   **          SSSS33 jj
                  ++ (add)        ++          SSSS33 kk
                  ,, (comma)      ,,          SSSS33 ll
                  -- (minus)      --          SSSS33 mm
                  .. (period)     ..          SSSS33 nn
                  // (divide)     //          SSSS33 oo
                  00              00          SSSS33 pp
                  11              11          SSSS33 qq
                  22              22          SSSS33 rr
                  33              33          SSSS33 ss
                  44              44          SSSS33 tt
                  55              55          SSSS33 uu
                  66              66          SSSS33 vv
                  77              77          SSSS33 ww
                  88              88          SSSS33 xx
                  99              99          SSSS33 yy
                  == ((eeqquuaall))      ==          SSSS33 XX
                  --------------------------------------

The VT220 provides a 6-key editing keypad, which is analogous to that on
the PC keyboard.  It is not affected by DDEECCCCKKMM or DDEECCPPNNMM/DDEECCPPAAMM:

                     KKeeyy       NNoorrmmaall    AApppplliiccaattiioonn
                   ----------------------------------
                   Insert     CCSSII 22 ~~    CCSSII 22 ~~
                   Delete     CCSSII 33 ~~    CCSSII 33 ~~
                   Home       CCSSII 11 ~~    CCSSII 11 ~~
                   End        CCSSII 44 ~~    CCSSII 44 ~~
                   PageUp     CCSSII 55 ~~    CCSSII 55 ~~
                   PageDown   CCSSII 66 ~~    CCSSII 66 ~~
                   ----------------------------------

The VT220 provides 8 additional function keys.  With a Sun/PC keyboard,
access these keys by Control/F1 for F13, etc.

                         KKeeyy      EEssccaappee SSeeqquueennccee
                       ---------------------------
                       FF1133        CCSSII 22 55 ~~
                       FF1144        CCSSII 22 66 ~~
                       FF1155        CCSSII 22 88 ~~
                       FF1166        CCSSII 22 99 ~~
                       FF1177        CCSSII 33 11 ~~
                       FF1188        CCSSII 33 22 ~~
                       FF1199        CCSSII 33 33 ~~
                       FF2200        CCSSII 33 44 ~~
                       ---------------------------


VVTT5522--SSttyyllee FFuunnccttiioonn KKeeyyss
A VT52 does not have function keys, but it does have a numeric keypad
and cursor keys.  They differ from the other emulations by the prefix.
Also, the cursor keys do not change:

                       KKeeyy        NNoorrmmaall//AApppplliiccaattiioonn
                   ----------------------------------
                   CCuurrssoorr UUpp      EESSCC AA
                   CCuurrssoorr DDoowwnn    EESSCC BB
                   CCuurrssoorr RRiigghhtt   EESSCC CC
                   CCuurrssoorr LLeefftt    EESSCC DD
                   ----------------------------------

The keypad is similar:

                      KKeeyy        NNuummeerriicc    AApppplliiccaattiioonn
                  --------------------------------------
                  SSppaaccee          SSPP         EESSCC ?? SSPP
                  TTaabb            TTAABB        EESSCC ?? II
                  EEnntteerr          CCRR         EESSCC ?? MM
                  PPFF11            EESSCC PP      EESSCC PP
                  PPFF22            EESSCC QQ      EESSCC QQ
                  PPFF33            EESSCC RR      EESSCC RR
                  PPFF44            EESSCC SS      EESSCC SS
                  ** (multiply)   **          EESSCC ?? jj
                  ++ (add)        ++          EESSCC ?? kk
                  ,, (comma)      ,,          EESSCC ?? ll
                  -- (minus)      --          EESSCC ?? mm
                  .. (period)     ..          EESSCC ?? nn
                  // (divide)     //          EESSCC ?? oo
                  00              00          EESSCC ?? pp
                  11              11          EESSCC ?? qq
                  22              22          EESSCC ?? rr
                  33              33          EESSCC ?? ss
                  44              44          EESSCC ?? tt
                  55              55          EESSCC ?? uu
                  66              66          EESSCC ?? vv
                  77              77          EESSCC ?? ww
                  88              88          EESSCC ?? xx
                  99              99          EESSCC ?? yy
                  == ((eeqquuaall))      ==          EESSCC ?? XX
                  --------------------------------------


SSuunn--SSttyyllee FFuunnccttiioonn KKeeyyss
The _x_t_e_r_m program provides support for Sun keyboards more directly, by a
menu toggle that causes it to send Sun-style function key codes rather
than VT220.  Note, however, that the _s_u_n and _V_T_1_0_0 emulations are not
really compatible.  For example, their wrap-margin behavior differs.
Only function keys are altered; keypad and cursor keys are the same.
The emulation responds identically.  See the xterm-sun terminfo entry
for details.

HHPP--SSttyyllee FFuunnccttiioonn KKeeyyss
Similarly, _x_t_e_r_m can be compiled to support HP keyboards.  See the
xterm-hp terminfo entry for details.

TThhee AAlltteerrnnaattee SSccrreeeenn BBuuffffeerr
XXtteerrmm maintains two screen buffers.  The normal screen buffer allows you
to scroll back to view saved lines of output up to the maximum set by
the ssaavveeLLiinneess resource.  The alternate screen buffer is exactly as large
as the display, contains no additional saved lines.  When the alternate
screen buffer is active, you cannot scroll back to view saved lines.
XXtteerrmm provides control sequences and menu entries for switching between
the two.
Most full-screen applications use terminfo or termcap to obtain strings
used to start/stop full-screen mode, i.e., _s_m_c_u_p and _r_m_c_u_p for terminfo,
or the corresponding _t_i and _t_e for termcap.  The ttiitteeIInnhhiibbiitt resource
removes the _t_i and _t_e strings from the TERMCAP string which is set in
the environment for some platforms.  That is not done when xxtteerrmm is
built with terminfo libraries because terminfo does not provide the
whole text of the termcap data in one piece.  It would not work for ter-
minfo anyway, since terminfo data is not passed in environment vari-
ables; setting an environment variable in this manner would have no
effect on the application's ability to switch between normal and alter-
nate screen buffers.  Instead, the newer private mode controls (such as
1 0 4 9 ) for switching between normal and alternate screen buffers sim-
ply disable the switching.  They add other features such as clearing the
display for the same reason: to make the details of switching indepen-
dent of the application that requests the switch.

MMoouussee TTrraacckkiinngg
The VT widget can be set to send the mouse position and other informa-
tion 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 six mutually exclusive modes.  One is DEC Locator mode,
enabled by the DECELR CSI _P_s ; _P_s  'z control sequence, and is not
described here (control sequences are summarized above).  The remaining
five modes are each enabled (or disabled) by a different parameter in
DECSET CSI ? _P_m h or DECRST CSI ? _P_m l control sequence.

Manifest constants for the parameter values are defined in xxcchhaarrmmoouussee..hh
as follows:

                #define SET_X10_MOUSE               9
                #define SET_VT200_MOUSE             1000
                #define SET_VT200_HIGHLIGHT_MOUSE   1001
                #define SET_BTN_EVENT_MOUSE         1002
                #define SET_ANY_EVENT_MOUSE         1003

The motion reporting modes are strictly _x_t_e_r_m extensions, and are not
part of any standard, though they are analogous to the DEC VT200 DECELR
locator reports.

Parameters (such as pointer position and button number) for all mouse
tracking escape sequences generated by _x_t_e_r_m encode numeric parameters
in a single character as _v_a_l_u_e+32.  For example, !  specifies the value
1.  The upper left character position on the terminal is denoted as 1,1.

X10 compatibility mode sends an escape sequence only on button press,
encoding the location and the mouse button pressed.  It is enabled by
specifying parameter 9 to DECSET.  On button press, _x_t_e_r_m sends CSI M
_C_b_C_x_C_y (6 characters).  _C_b is button-1.  _C_x and _C_y are the x and y coor-
dinates of the mouse when the button was pressed.

Normal tracking mode sends an escape sequence on both button press and
release.  Modifier key (shift, ctrl, meta) information is also sent.  It
is enabled by specifying parameter 1000 to DECSET.  On button press or
release, _x_t_e_r_m sends CSI M _C_b_C_x_C_y.  The low two bits of _C_b encode button
information: 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release.
The next three bits encode the modifiers which were down when the button
was pressed and are added together:  4=Shift, 8=Meta, 16=Control.  Note
however that the shift and control bits are normally unavailable because
_x_t_e_r_m uses the control modifier with mouse for popup menus, and the
shift modifier is used in the default translations for button events.
The _M_e_t_a modifier recognized by _x_t_e_r_m is the _m_o_d_1 mask, and is not nec-
essarily the "Meta" key (see _x_m_o_d_m_a_p).  _C_x and _C_y are the x and y coor-
dinates of the mouse event, encoded as in X10 mode.

Wheel mice may return buttons 4 and 5.  Those buttons are represented by
the same event codes as buttons 1 and 2 respectively, except that 64 is
added to the event code.  Release events for the wheel buttons are not
reported.

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.  Highlighting is performed only for button 1, though other but-
ton events can be received.  WWaarrnniinngg:: use of this mode requires a coop-
erating program or it will hang _x_t_e_r_m_.  On button press, the same infor-
mation as for normal tracking is generated; _x_t_e_r_m then waits for the
program to send mouse tracking information.  _A_l_l _X _e_v_e_n_t_s _a_r_e _i_g_n_o_r_e_d
_u_n_t_i_l _t_h_e _p_r_o_p_e_r _e_s_c_a_p_e _s_e_q_u_e_n_c_e _i_s _r_e_c_e_i_v_e_d _f_r_o_m _t_h_e _p_t_y_: CSI _P_s ; _P_s ;
_P_s ; _P_s ; _P_s T .  The parameters are _f_u_n_c_, _s_t_a_r_t_x_, _s_t_a_r_t_y_, _f_i_r_s_t_r_o_w_, and
_l_a_s_t_r_o_w_.  _f_u_n_c is non-zero to initiate hilite tracking and zero to
abort.  _s_t_a_r_t_x and _s_t_a_r_t_y give the starting x and y location for the
highlighted region.  The ending location tracks the mouse, but will
never be above row _f_i_r_s_t_r_o_w and will always be above row _l_a_s_t_r_o_w_.  (The
top of the screen is row 1.)  When the button is released, _x_t_e_r_m reports
the ending position one of two ways: if the start and end coordinates
are valid text locations: CSI t _C_x_C_y.  If either coordinate is past the
end of the line: CSI T _C_x_C_y_C_x_C_y_C_x_C_y.  The parameters are _s_t_a_r_t_x_, _s_t_a_r_t_y_,
_e_n_d_x_, _e_n_d_y_, _m_o_u_s_e_x_, and _m_o_u_s_e_y_.  _s_t_a_r_t_x_, _s_t_a_r_t_y_, _e_n_d_x_, and _e_n_d_y give the
starting and ending character positions of the region.  _m_o_u_s_e_x and
_m_o_u_s_e_y give the location of the mouse at button up, which may not be
over a character.

Button-event tracking is essentially the same as normal tracking, but
_x_t_e_r_m also reports button-motion events.  Motion events are reported
only if the mouse pointer has moved to a different character cell.  It
is enabled by specifying parameter 1002 to DECSET.  On button press or
release, _x_t_e_r_m sends the same codes used by normal tracking mode.  On
button-motion events, _x_t_e_r_m adds 32 to the event code (the third charac-
ter, _C_b).  The other bits of the event code specify button and modifier
keys as in normal mode.  For example, motion into cell x,y with button 1
down is reported as CSI M @ _C_x_C_y.  ( @  = 32 + 0 (button 1) + 32 (motion
indicator) ).  Similarly, motion with button 3 down is reported as CSI M
B _C_x_C_y.  ( B  = 32 + 2 (button 3) + 32 (motion indicator) ).

Any-event mode is the same as button-event mode, except that all motion
events are reported, even if no mouse button is down.  It is enabled by
specifying 1003 to DECSET.

TTeekkttrroonniixx 44001144 MMooddee
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-through 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 _x_t_e_r_m) (ESC Ctrl-N)
ESC SI         End 4015 APL mode (ignored by _x_t_e_r_m) (ESC Ctrl-O)
ESC ETB        COPY (Save Tektronix Codes to file COPYyyyy-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
OSC _P_s ; _P_t BEL
               Set Text Parameters of VT window
                 _P_s = 0  -> Change Icon Name and Window Title to _P_t
                 _P_s = 1  -> Change Icon Name to _P_t
                 _P_s = 2  -> Change Window Title to _P_t
                 _P_s = 4 6  -> Change Log File to _P_t (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-_)

VVTT5522 MMooddee
Parameters for cursor movement are at the end of the ESC Y  escape
sequence.  Each ordinate is encoded in a single character as _v_a_l_u_e+32.
For example, !  is 1.  The screen coodinate system is 0-based.

ESC A          Cursor up.
ESC B          Cursor down.
ESC C          Cursor right.
ESC D          Cursor left.
ESC F          Enter graphics mode.
ESC G          Exit graphics mode.
ESC H          Move the cursor to the home position.
ESC I          Reverse line feed.
ESC J          Erase from the cursor to the end of the screen.
ESC K          Erase from the cursor to the end of the line.
ESC Y _P_s _P_s    Move the cursor to given row and column.
ESC Z          Identify
                 -> ESC  /  Z  (``I am a VT52.'')
ESC =          Enter alternate keypad mode.
ESC >          Exit alternate keypad mode.
ESC <          Exit VT52 mode (Enter VT100 mode).
