macro "pl" not recognized -- ignoring macro "ND" not recognized -- ignoring XTerm Control Sequences Edward Moy University of California, Berkeley
Revised by Stephen Gildea
X Consortium (1994) Thomas Dickey XFree86 Project (1996-2006) invisible-island.net
(2006-2015) updated for XTerm F (2015/04/12)
The xterm 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 equivalent:
These control characters are used in the vtXXX emulation.
Most of these control sequences are standard VT102 control sequences, but there is support for later DEC VT terminals (i.e., VT220, VT320, VT420, VT510), as well as ISO 6429 and aixterm color controls. The only VT102 feature not supported is auto-repeat, since the only way X provides for this will affect all windows.
There are additional control sequences to provide xterm-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 discussion of character sets).
Many of the features are optional; xterm can be configured and built without support for them.
$*
$*
This excludes controls where s is part of a 7-bit equivalent to 8-bit C1
controls, ordered by the final character(s).
Final character CAN
c for designating 94-character sets. In this list, 0,
A and B apply to VT100 and up, the remainder to VT220 and up. The VT220
character sets, together with the Portuguese character set are activated
by the National Replacement Character controls. The A is a special case,
since it is also activated by the VT300-control for British Latin-1 separately
from the National Replacement Character controls. CAN
c = 0 -> DEC Special
Character and Line Drawing Set.
CAN
c = < -> DEC Supplementary (VT200).
CAN
c = %5 -> DEC Supplementary Graphics (VT300).
CAN
c = > -> DEC Technical (VT300).
CAN
c = A -> United Kingdom (UK).
CAN
c = B -> United States (USASCII).
CAN
c = 4 -> Dutch.
CAN
c = CAN
or 5 -> Finnish.
CAN
c = R or f -> French.
CAN
c = Q or 9 -> French Canadian (VT200, VT300).
CAN
c = K -> German.
CAN
c = Y -> Italian.
CAN
c = `, or 6 -> Norwegian/Danish.
CAN
c = %6 -> Portuguese (VT300).
CAN
c = Z -> Spanish.
CAN
c = H or 7 -> Swedish.
CAN
c = = -> Swiss.
The same character sets apply as for s(CAN
c.
$*
$*
$*
If 16-color support is compiled, the following apply. Assume that xterm's
resources are set so that the ISO color codes are the first 8 of a set
of 16. Then the aixterm colors are the bright versions of the ISO colors:
Ps = 90 -> Set foreground color to Black.
Ps = 91 -> Set foreground color to Red.
Ps = 92 -> Set foreground color to Green.
Ps = 93 -> Set foreground color to Yellow.
Ps = 94 -> Set foreground color to Blue.
Ps = 95 -> Set foreground color to Magenta.
Ps = 96 -> Set foreground color to Cyan.
Ps = 97 -> Set foreground color to White.
Ps = 100 -> Set background color to Black.
Ps = 101 -> Set background color to Red.
Ps = 102 -> Set background color to Green.
Ps = 103 -> Set background color to Yellow.
Ps = 104 -> Set background color to Blue.
Ps = 105 -> Set background color to Magenta.
Ps = 106 -> Set background color to Cyan.
Ps = 107 -> Set background color to White.
If xterm is compiled with the 16-color support disabled, it supports
the following, from rxvt: Ps = 100 -> Set foreground and background color
to default.
Xterm maintains a color palette whose entries are identified by an index beginning with zero. If 88- or 256-color support is compiled, the following apply:
·- All parameters are decimal integers.
·- RGB values range from zero (0) to 255.
·- ISO-8613-3 can be interpreted in more than one way; xterm allows the semicolons in this control to be replaced by colons (but after the first colon, colons must be used).
These ISO-8613-3 controls are supported:
Ps = 38;2;Pr;Pg;Pb -> Set foreground color to the closest match in xterm's
palette for the given RGB Pr/Pg/Pb.
Ps = 38;5;Ps -> Set foreground color to the second Ps.
Ps = 48;2;Pr;Pg;Pb -> Set background color to the closest match in xterm's
palette for the given RGB Pr/Pg/Pb.
Ps = 48;5;Ps -> Set background color to the second Ps.
Note: it is possible for this sequence to be sent
by a function key. For example, with the default keyboard configuration
the shifted F1 key may send (with shift-, control-, alt-modifiers)
CAN
s1;2R, or
CAN
s1;5R, or
CAN
s1;6R, etc.
The second parameter encodes the modifiers; values range from 2 to 16. See
the section PC-Style Function Keys for the codes. The modifyFunctionKeys
and modifyKeyboard resources can change the form of the string sent from
the modified F1 key.
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 rectangles have been enabled wmacro "in" not recognized -- ignoring ith a DECEFR.
-> CAN
sPe;Pb;Pr;Pc;Pp&w
Parameters are [event;button;row;column;page].
Valid values for the event: Pe = 0 -> locator unavailable - no other parameters
sent.
Pe = 1 -> request - xterm received a DECRQLP.
Pe = 2 -> left button down.
Pe = 3 -> left button up.
Pe = 4 -> middle button down.
Pe = 5 -> middle button up.
Pe = 6 -> right button down.
Pe = 7 -> right button up.
Pe = 8 -> M4 button down.
Pe = 9 -> M4 button up.
Pe = 10 -> locator outside filter rectangle.
The ``button'' parameter is a bitmask indicating which buttons are pressed:
Pb = 0 <- no buttons down.
Pb & 1 <- right button down.
Pb & 2 <- middle button down.
Pb & 4 <- left button down.
Pb & 8 <- M4 button down.
The ``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.
$*
If a "?" is given rather than a name or RGB specification, 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 specification can be given in one control sequence, xterm can make more than one reply.
Ps = 5;c;spec
-> Change Special Color Number c to
the color specified by spec. This can be a name or RGB specification as
per XParseColor. Any number of c/spec pairs may be given. The special colors
can also be set by adding the maximum number of colors to these codes in
an s4 control:
Pc = 0 <- resource colorBD (BOLD).
Pc = 1 <- resource colorUL (UNDERLINE).
Pc = 2 <- resource colorBL (BLINK).
Pc = 3 <- resource colorRV (REVERSE).
Pc = 4 <- resource colorIT (ITALIC).
Ps = 6;c;f -> Enable/disable Special Color Number c.
s6 is the same as s106.
The 10 colors (below) which may be set or queried using 10 through 19 are denoted dynamic colors, since the corresponding control sequences were the first means for setting xterm's colors dynamically, i.e., after it was started. They are not the same as the ANSI colors. These controls may be disabled using the allowColorOps resource. At least one parameter is expected for Pt. Each successive parameter changes the next color in the list. The value of Ps tells the starting point in the list. The colors are specified by name or RGB specification as per XParseColor.
If a "?" is given rather than a name or RGB specification, 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, xterm can make more than one reply.
Ps = 10 -> Change VT100 text foreground color to Pt.
Ps = 11 -> Change VT100 text background color to Pt.
Ps = 12 -> Change text cursor color to Pt.
Ps = 13 -> Change mouse foreground color to Pt.
Ps = 14 -> Change mouse background color to Pt.
Ps = 15 -> Change Tektronix foreground color to Pt.
Ps = 16 -> Change Tektronix background color to Pt.
Ps = 17 -> Change highlight background color to Pt.
Ps = 18 -> Change Tektronix cursor color to Pt.
Ps = 19 -> Change highlight foreground color to Pt.
Ps = 46 -> Change Log File to Pt. (This is normally disabled by a
compile-time option).
Ps = 50 -> Set Font to Pt.
These controls may be disabled using the allowFontOps resource. If Pt 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 indexing).
The same rule (plus or minus sign, optional number) is used when querying
the font. The remainder of Pt is ignored.
A font can be specified after a "#" index expression, by adding a space
and then the font specifier.
If the "TrueType Fonts" menu entry is set (the renderFont resource), then
this control sets/queries the faceName resource.
Ps = 51 -> reserved for
Emacs shell.
Ps = 52 -> Manipulate Selection Data.
These controls may be disabled using the allowWindowOps resource. The parameter
Pt is parsed as
Pc;Pd
The first, Pc, may contain zero or more characters from the set c p cs
0 1 2 3 4 5 6 7. It is used to construct a list of selection parameters
for clipboard, primary, select, or cut buffers 0 through 7 respectively,
in the order given. If the parameter is empty, xterm uses cs0, to specify
the configurable primary/clipboard selection and cut buffer 0.
The second parameter, Pd, gives the selection data. Normally this is a string
encoded in base64. The data becomes the new selection, which is then available
for pasting by other applications.
If the second parameter is a ?, xterm replies to the host with the selection
data encoded using the same protocol.
If the second parameter is neither a base64 string nor ?, then the selection
is cleared.
Ps = 104;c -> Reset Color Number c. It is reset to
the color specified by the corresponding X resource. Any number of c parameters
may be given. These parameters correspond to the ANSI colors 0-7, their bright
versions 8-15, and if supported, the remainder of the 88-color or 256-color
table. If no parameters are given, the entire table will be reset.
Ps
= 105;c -> Reset Special Color Number c. It is reset to
the color specified by the corresponding X resource. Any number of c parameters
may be given. These parameters correspond to the special colors which can
be set using an s5 control (or by adding the maximum number of colors using
an s4 control).
Ps = 106;c;f -> Enable/disable Special Color Number c.
The second parameter tells xterm to enable the corresponding color mode
if nonzero, disable it if zero.
Pc = 0 <- resource colorBDMode (BOLD).
Pc = 1 <- resource colorULMode (UNDERLINE).
Pc = 2 <- resource colorBLMode (BLINK).
Pc = 3 <- resource colorRVMode (REVERSE).
Pc = 4 <- resource colorITMode (ITmacro "T&" not recognized -- ignoring
ALIC).
Pc = 5 <- resource colorAttrMode (Override ANSI).
The dynamic colors can also be reset to their default (resource) values:
Ps = 110 -> Reset VT100 text foreground color.
Ps = 111 -> Reset VT100 text background color.
Ps = 112 -> Reset text cursor color.
Ps = 113 -> Reset mouse foreground color.
Ps = 114 -> Reset mouse background color.
Ps = 115 -> Reset Tektronix foreground color.
Ps = 116 -> Reset Tektronix background color.
Ps = 117 -> Reset highlight color.
Ps = 118 -> Reset Tektronix cursor color.
Ps = 119 -> Reset highlight foreground color.
$*
Many keyboards have keys labeled "Alt". Few have keys labeled "Meta". However, xterm's default translations use the Meta modifier. Common keyboard configurations assign the Meta modifier to an "Alt" key. By using xmodmap one may have the modifier assigned to a different key, and have "real" alt and meta keys. Here is an example: ! put meta on mod3 to distinguish it from alt keycode 64 = Alt_L clear mod1 add mod1 = Alt_L keycode 115 = Meta_L clear mod3 add mod3 = Meta_L
The metaSendsEscape resource (and altSendsEscape if altIsNotMeta is set) can be used to control the way the Meta modifier applies to ordinary keys unless the modifyOtherKeys resource is set:
The table shows the result for a given character "x" with modifiers according to the default translations with the resources set on or off. This assumes altIsNotMeta is set:
l | l | l | l . |
key altSendsEscape metaSendsEscape result |
x off off x |
Meta-x off off shift |
Alt-x off off shift |
Alt+Meta-x off off shift |
x ON off x |
Meta-x ON off shift |
Alt-x ON off s x |
Alt+Meta-x ON off s shift |
x off ON x |
Meta-x off ON s x |
Alt-x off ON shift |
Alt+Meta-x off ON s shift |
x ON ON x |
Meta-x ON ON s x |
Alt-x ON ON s x |
Alt+Meta-x ON ON s x |
If xterm 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 numLock resource, or by the "DECSET 1035" control sequence.
The cursor keys transmit the following escape sequences depending on the mode specified via the DECCKM escape sequence.
Key | Normal | Application |
l | l | l . | ||
Cursor Up | CAN sA | SUB 3A |
Cursor Down | CAN sB | SUB 3B |
Cursor Right | CAN sCAN | SUB 3CAN |
Cursor Left | CAN sD | SUB 3D |
Key | Normal | Application |
l | l | l . | ||
Home | CAN sH | SUB 3H |
End | CAN sF | SUB 3F |
The application keypad transmits the following escape sequences depending on the mode specified via the DECKPNM and DECKPAM 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.
Key | Numeric | Application | Terminfo | Termcap |
l | l | l | l | l . | ||||
Space | SUB p | SUB 3SUB p | - | - |
Tab | TAB a | SUB 3I | - | - |
Enter | CAN r | SUB 3M | kent | @8 |
PF1 | SUB 3P | SUB 3P | kf1 | k1 |
PF2 | SUB 3Q | SUB 3Q | kf2 | k2 |
PF3 | SUB 3R | SUB 3R | kf3 | k3 |
PF4 | SUB 3SUB | SUB 3SUB | kf4 | k4 |
* (multiply) | * | SUB 3j | - | - |
+ (add) | + | SUB 3k | - | - |
, (comma) | , | SUB 3l | - | - |
- (minus) | - | SUB 3m | - | - |
. (Delete) | . | CAN s3c~ | - | - |
/ (divide) | / | SUB 3o | - | - |
0 (Insert) | 0 | CAN s2c~ | - | - |
1 (End) | 1 | SUB 3F | kc1 | K4 |
2 (DownArrow) | 2 | CAN sB | - | - |
3 (PageDown) | 3 | CAN s6c~ | kc3 | K5 |
4 (LeftArrow) | 4 | CAN sD | - | - |
5 (Begin) | 5 | CAN s | kb2 | K2 |
6 (RightArrow) | 6 | CAN sCAN | - | - |
7 (Home) | 7 | SUB 3H | ka1 | K1 |
8 (UpArrow) | 8 | CAN sA | - | - |
9 (PageUp) | 9 | CAN s5c~ | ka3 | K3 |
= (equal) | = | SUB 3ETX X | - | - |
Key | Escape Sequence |
l | l . | |
F1 | SUB 3P |
F2 | SUB 3Q |
F3 | SUB 3R |
F4 | SUB 3SUB |
F5 | CAN s15c~ |
F6 | CAN s17c~ |
F7 | CAN s18c~ |
F8 | CAN s19c~ |
F9 | CAN s20c~ |
F10 | CAN s21c~ |
F11 | CAN s23c~ |
F12 | CAN s24c~ |
Older versions of xterm implement different escape sequences for F1 through F4. These can be activated by setting the oldXtermFKeys resource. However, since they do not correspond to any hardware terminal, they have been deprecated. (The DEC VT220 reserves F1 through F5 for local functions such as Setup).
Key | Escape Sequence |
l | l . | |
F1 | CAN s11c~ |
F2 | CAN s12c~ |
F3 | CAN s13c~ |
F4 | CAN s14c~ |
Code | Modifiers |
c | l . | |
2 | Shift |
3 | Alt |
4 | Shift + Alt |
5 | Control |
6 | Shift + Control |
7 | Alt + Control |
8 | Shift + Alt + Control |
9 | Meta |
10 | Meta + Shift |
11 | Meta + Alt |
12 | Meta + Alt + Shift |
13 | Meta + Ctrl |
14 | Meta + Ctrl + Shift |
15 | Meta + Ctrl + Alt |
16 | Meta + Ctrl + Alt + Shift |
If the alwaysUseMods resource is set, the Meta modifier also is recognized, making parameters 9 through 16.
However, xterm is most useful as a DEC VT102 or VT220 emulator. Set the sunKeyboard 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 keypad:
Key | Numeric | Application |
l | l | l . | ||
Space | SUB p | SUB 3SUB p |
Tab | TAB a | SUB 3I |
Enter | CAN r | SUB 3M |
PF1 | SUB 3P | SUB 3P |
PF2 | SUB 3Q | SUB 3Q |
PF3 | SUB 3R | SUB 3R |
PF4 | SUB 3SUB | SUB 3SUB |
* (multiply) | * | SUB 3j |
+ (add) | + | SUB 3k |
, (comma) | , | SUB 3l |
- (minus) | - | SUB 3m |
. (period) | . | SUB 3n |
/ (divide) | / | SUB 3o |
0 | 0 | SUB 3p |
1 | 1 | SUB 3q |
2 | 2 | SUB 3r |
3 | 3 | SUB 3cs |
4 | 4 | SUB 3t |
5 | 5 | SUB 3u |
6 | 6 | SUB 3v |
7 | 7 | SUB 3w |
8 | 8 | SUB 3x |
9 | 9 | SUB 3y |
= (equal) | = | SUB 3ETX X |
Key | Normal | Application |
l | l | l . | ||
Insert | CAN s2c~ | CAN s2c~ |
Delete | CAN s3c~ | CAN s3c~ |
Home | CAN s1c~ | CAN s1c~ |
End | CAN s4c~ | CAN s4c~ |
PageUp | CAN s5c~ | CAN s5c~ |
PageDown | CAN s6c~ | CAN s6c~ |
The VT220 provides 8 additional function keys. With a Sun/PC keyboard, access these keys by Control/F1 for F13, etc.
Key | Escape Sequence |
l | l . | |
F13 | CAN s25c~ |
F14 | CAN s26c~ |
F15 | CAN s28c~ |
F16 | CAN s29c~ |
F17 | CAN s31c~ |
F18 | CAN s32c~ |
F19 | CAN s33c~ |
F20 | CAN s34c~ |
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:
Key | Normal/Application |
l | l . | |
Cursor Up | sA |
Cursor Down | sB |
Cursor Right | sCAN |
Cursor Left | sD |
Key | Numeric | Application |
l | l | l . | ||
Space | SUB p | s?SUB p |
Tab | TAB a | s?I |
Enter | CAN r | s?M |
PF1 | sP | sP |
PF2 | sQ | sQ |
PF3 | sR | sR |
PF4 | sSUB | sSUB |
* (multiply) | * | s?j |
+ (add) | + | s?k |
, (comma) | , | s?l |
- (minus) | - | s?m |
. (period) | . | s?n |
/ (divide) | / | s?o |
0 | 0 | s?p |
1 | 1 | s?q |
2 | 2 | s?r |
3 | 3 | s?cs |
4 | 4 | s?t |
5 | 5 | s?u |
6 | 6 | s?v |
7 | 7 | s?w |
8 | 8 | s?x |
9 | 9 | s?y |
= (equal) | = | s?ETX X |
The xterm 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 sun and VT100 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.
Similarly, xterm can be compiled to support HP keyboards. See the xterm-hp terminfo entry for details.
Xterm 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 saveLines 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. Xterm 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., smcup and rmcup for terminfo, or the corresponding ti and te for termcap. The titeInhibit resource removes the ti and te strings from the TERMCAP string which is set in the environment for some platforms. That is not done when xterm 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 terminfo anyway, since terminfo data is not passed in environment variables; setting an environment variable in this manner would have no effect on the application's ability to switch between normal and alternate screen buffers. Instead, the newer private mode controls (such as 1049) for switching between normal and alternate screen buffers simply disable the switching. They add other features such as clearing the display for the same reason: to make the details of switching independent of the application that requests the switch.
When bracketed paste mode is set, pasted text is bracketed with control
sequences so that the program can differentiate pasted text from typed-in
text. When bracketed paste mode is set, the program will receive: s[200~,
followed by the pasted text, followed by s[201~.
The window- and icon-labels can be set or queried using control sequences. As a VT220-emulator, xterm "should" limit the character encoding for the corresponding strings to ISO-8859-1. Indeed, it used to be the case (and was documented) that window titles had to be ISO-8859-1. This is no longer the case. However, there are many applications which still assume that titles are set using ISO-8859-1. So that is the default behavior.
If xterm is running with UTF-8 encoding, it is possible to use window- and icon-labels encoded using UTF-8. That is because the underlying X libraries (and many, but not all) window managers support this feature.
The utf8Title X resource setting tells xterm to disable a reconversion of the title string back to ISO-8859-1, allowing the title strings to be interpreted as UTF-8. The same feature can be enabled using the title mode control sequence described in this summary.
Separate from the ability to set the titles, xterm provides the ability to query the titles, returning them either in ISO-8859-1 or UTF-8. This choice is available only while xterm is using UTF-8 encoding.
Finally, the characters sent to, or returned by a title control are less constrained than the rest of the control sequences. To make them more manageable (and constrained), for use in shell scripts, xterm has an optional feature which decodes the string from hexadecimal (for setting titles) or for encoding the title into hexadecimal when querying the value.
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 two sets of mutually exclusive modes:
The mouse protocols include DEC Locator mode, enabled by the DECELR CAN sPs;Ps'z control sequence, and is not described here (control sequences are summarized above). The remaining five modes of the mouse protocols are each enabled (or disabled) by a different parameter in the "DECSET CAN s?Pmh" or "DECRST CAN s?Pml" control sequence.
Manifest constants for the parameter values are defined in xcharmouse.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
#define SET_FOCUS_EVENT_MOUSE 1004
#define SET_EXT_MODE_MOUSE 1005 #define SET_SGR_EXT_MODE_MOUSE 1006 #define SET_URXVT_EXT_MODE_MOUSE 1015
#define SET_ALTERNATE_SCROLL
1007
The motion reporting modes are strictly xterm extensions, and are not part
of any standard, though they are analogous to the DEC VT200 DECELR locator
reports.
Normally, parameters (such as pointer position and button number) for all mouse tracking escape sequences generated by xterm encode numeric parameters in a single character as value+32. For example, ! specifies the value 1. The upper left character position on the terminal is denoted as 1,1. This scheme dates back to X10, though the normal mouse-tracking (from X11) is more elaborate.
$*
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, xterm sends CAN sMCAN bCAN xCAN y (6 characters).
$*
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, xterm sends CAN sMCAN bCAN xCAN y.
$*
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. By default, the wheel mouse events are translated to scroll-back and scroll-forw actions. Those actions normally scroll the whole window, as if the scrollbar was used. However if Alternate Scroll mode is set, then cursor up/down controls are sent when the terminal is displaying the alternate screen. The initial state of Alternate Scroll mode is set using the alternateScroll resource.
$*
Mouse highlight 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 button events can be received.
Warning: 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: CAN sPs;Ps;Ps;Ps;PsTAB . The parameters are func, startx, starty, firstrow, and lastrow. func is non-zero to initiate highlight 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:
$*
Button-event tracking is essentially the same as normal tracking, but xterm 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, xterm sends the same codes used by normal tracking mode.
$*
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.
$*
FocusIn/FocusOut can be combined with any of the mouse events since it uses a different protocol. When set, it causes xterm to send CAN sI when the terminal gains focus, and CAN s when it loses focus.
$*
The original X10 mouse protocol limits the CAN x and CAN y ordinates to 223 (=255 - 32). Xterm supports more than one scheme for extending this range, by changing the protocol encoding:
·- The encoded button value in this case does not add 32 since that was useful only in the X10 scheme for ensuring that the byte containing the button value is a printable code.
·- The modifiers are encoded in the same way.
·- A different final character is used for button release to resolve the X10 ambiguity regarding which button was released.
If xterm is configured as VT240, VT241, VT330, VT340 or VT382 using the decTerminalID resource, it supports Sixel Graphics controls, a palleted bitmap graphics system using sets of six vertical pixels as the basic element.
If xterm is configured as VT125, VT240, VT241, VT330 or VT340 using the decTerminalID resource, it supports Remote Graphic Instruction Set, a graphics description language.
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.
Parameters for cursor movement are at the end of the sY escape sequence. Each ordinate is encoded in a single character as value+32. For example, ! is 1. The screen coordinate system is 0-based.