# Definitions
c	The literal character c
C	A single (required) character.
Ps	A single (usually optional) numeric parameter, composed of one of more digits.
Pm	A multiple numeric parameter composed of any number of single numeric parameters, separated by ; character(s). Individual values for the parameters are listed with Ps .
Pt	A text parameter composed of printable characters.
ESC = 27
CSI = ESC + "["
OSC = ESC + "]"



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


# VT100 Mode
## Single-character functions
BEL	Ctrl-G	Bell
BS	Ctrl-H	Backspace
CR	Ctrl-M	Carriage Return
ENQ	Ctrl-E	Return Terminal Status . Default response is the terminal name, e.g., "xterm", but may be overridden by a resource answerbackString.
FF	Ctrl-L	Form Feed or New Page (NP) same as LF
LF	Ctrl-J	Line Feed or New Line (NL)
SO	Ctrl-N	Shift Out -> Switch to Alternate Character Set: invokes the G1 character set.
SP	 	Space.
TAB	Ctrl-I	Horizontal Tab (HT)
VT	Ctrl-K	Vertical Tab same as LF
SI	Ctrl-O	Shift In -> Switch to Standard Character Set: invokes the G0 character set (the default).

## Controls beginning with ESC
Other than those where ESC is part of a 7-bit equivalent to 8-bit C1 controls), ordered by the final character(s).
ESC SP F	S7C1T	7-bit controls .
ESC SP G	S8C1T	8-bit controls .
ESC SP L		Set ANSI conformance level 1 (vt100, 7-bit controls).
ESC SP M		Set ANSI conformance level 2 (vt200).
ESC SP N		Set ANSI conformance level 3 (vt300).
ESC # 3	DECDHL	DEC double-height line, top half
ESC # 4	DECDHL	DEC double-height line, bottom half
ESC # 5	DECSWL	DEC single-width line
ESC # 6	DECDWL	DEC double-width line
ESC # 8	DECALN	DEC Screen Alignment Test
ESC % @	ISO 8859-1	Select default character set, (ISO 2022)
ESC % G	UTF-8	Select UTF-8 character set (ISO 2022)
ESC ( C	Designate G0	Designate G0 Character Set (ISO 2022)
ESC ) C	Designate G1	Designate G1 Character Set (ISO 2022)
ESC * C	Designate G2	Designate G2 Character Set (ISO 2022)
ESC + C	Designate G3	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):
                0	DEC Special Character and Line Drawing Set
                A	United Kingdom (UK)
                B	United States (USASCII)
                4	Dutch
                C	Finnish
                5	Finnish
                R	French
                Q	French Canadian
                K	German
                Y	Italian
                E	Norwegian/Danish
                6	Norwegian/Danish
                Z	Spanish
                H	Swedish
                7	Swedish
                =	Swiss




ESC 7	DECSC	Save Cursor
ESC 8	DECRC	Restore Cursor
ESC =	DECPAM	Application Keypad ()
ESC >	DECPNM	Normal Keypad ()
ESC F		Cursor to lower left corner of screen (if enabled by the hpLowerleftBugCompat resource).
ESC c	RIS	Full Reset ()
ESC l		Memory Lock (per HP terminals). Locks memory above the cursor.
ESC m		Memory Unlock (per HP terminals)
ESC n	LS2	Invoke the G2 Character Set ()
ESC o	LS3	Invoke the G3 Character Set ()
ESC |	LS3R	Invoke the G3 Character Set as GR (). Has no visible effect in xterm.
ESC }	LS2R	Invoke the G2 Character Set as GR (). Has no visible effect in xterm.
ESC ~	LS1R	Invoke the G1 Character Set as GR (). Has no visible effect in xterm.


# Application Program-Control functions

# Functions usingCSI, ordered by the final character(s)
CSI Ps @	ICH	Insert Ps (Blank) Character(s) (default = 1))
CSI Ps A	CUU	Cursor Up Ps Times (default = 1))
CSI Ps B	CUD	Cursor Down Ps Times (default = 1))
CSI Ps C	CUF	Cursor Forward Ps Times (default = 1))
CSI Ps D	CUB	Cursor Backward Ps Times (default = 1))
CSI Ps E	CNL	Cursor Next Line Ps Times (default = 1))
CSI Ps F	CPL	Cursor Preceding Line Ps Times (default = 1))
CSI Ps G	CHA	Cursor Character Absolute [column] (default = [row,1]))
CSI Ps ; Ps H	CUP	Cursor Position [row;column] (default = [1,1]))
CSI Ps I	CHT	Cursor Forward Tabulation Ps tab stops (default = 1))
CSI Ps J	ED	Erase in Display)
                        0	Erase Below (default)
                        1	Erase Above
                        2	Erase All
                        3	Erase Saved Lines (xterm)

CSI ? Ps J	DECSED	Erase in Display)
                        0	Erase to Right (default)
                        1	Erase to Left
                        2	Erase All

CSI Ps K	EL	Erase in Line)
                        0	Erase to Right (default)
                        1	Erase to Left
                        2	Erase All
CSI ? Ps K	DECSEL	Erase in Line
                        0	Selective Erase to Right (default)
                        1	Selective Erase to Left
                        2	Selective Erase All

CSI Ps L	IL	Insert Ps Line(s) (default = 1))
CSI Ps M	DL	Delete Ps Line(s) (default = 1))
CSI Ps P	DCH	Delete Ps Character(s) (default = 1))
CSI Ps S	SU	Scroll up Ps lines (default = 1))
CSI Ps T	SD	Scroll down Ps lines (default = 1))
CSI Ps ; Ps ; Ps ; Ps ; Ps T		Initiate hilite mouse tracking. Parameters are [func;startx;starty;firstrow;lastrow]. See Mouse Tracking
CSI Ps X	ECH	Erase Ps Character(s) (default = 1))
CSI Ps Z	CBT	Cursor Backward Tabulation Ps tab stops (default = 1))
CSI Pm `	HPA	Character Position Absolute [column] (default = [row,1]))
CSI Ps b	REP	Repeat the preceding graphic character Ps times)
CSI Ps c	Primary DA	Send Device Attributes

                        0 , 1 or omitted	request attributes from terminal. The response depends on the decTerminalId 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

CSI > Ps c	Secondary DA	Send Device Attributes
                            0 , 1 or omitted	request the terminal's identification code. The response depends on the decTerminalId resource setting. It should apply only to VT220 and up but xterm extends this to VT100.
                        -> CSI Pp ; Pv ; Pc c
                        where Pp denotes the terminal type
                        -> 0  (``VT100'')
                        -> 1  (``VT220'')
                        and Pv is the firmware version (for xterm, this is the
                        XFree86 patch number, starting with 95).  In a DEC terminal, 
                        Pc indicates the ROM cartridge registration number
                        and is always zero.


CSI Pm d	VPA	Line Position Absolute [row] (default = [1,column]))
CSI Ps ; Ps f	HVP	Horizontal and Vertical Position [row;column] (default = [1,1]))
CSI Ps g	TBC	Tab Clear)
                        0	Clear Current Column (default)
                        3	Clear All

CSI Pm h	SM	Set Mode)
                        2	Keyboard Action Mode (AM)
                        4	Insert Mode (IRM)
                        1 2	Send/receive (SRM)
                        2 0	Automatic Newline (LNM)

CSI Pm l	RM	Reset Mode)
                        2	Keyboard Action Mode (AM)
                        4	Replace Mode (IRM)
                        1 2	Send/receive (SRM)
                        2 0	Normal Linefeed (LNM)

CSI ? Pm h	DECSET	DEC Private Mode Set
                        1	Application Cursor Keys DECCKM
                        2	Designate USASCII for character sets G0-G3 (DECANM), and set VT100 mode.
                        3	132 Column Mode (DECCOLM)
                        4	Smooth (Slow) Scroll (DECSCLM)
                        5	Reverse Video (DECSCNM)
                        6	Origin Mode (DECOM)
                        7	Wraparound Mode (DECAWM)
                        8	Auto-repeat Keys (DECARM)
                        9	Send Mouse X & Y on button press. See the section Mouse Tracking.
                        1 8	Print form feed (DECPFF)
                        1 9	Set print extent to full screen (DECPEX)
                        2 5	Show Cursor (DECTCEM)
                        3 0	Show scrollbar [rxvt].
                        3 5	Enable shifted key-functions [rxvt].
                        3 8	Enter Tektronix Mode (DECTEK)
                        4 0	Allow 80 <-> 132 Mode
                        4 1	more(1) fix (see curses resource)
                        4 2	Enable Nation Replacement Character sets (DECNRCM)
                        4 4	Turn On Margin Bell
                        4 5	Reverse-wraparound Mode
                        4 6	Start Logging (normally disabled by a compile-time option)
                        4 7	Use Alternate Screen Buffer (unless disabled by the titleInhibit resource
                        6 6	Application keypad (DECNKM)
                        6 7	Backarrow key sends delete (DECBKM)
                        1 0 0 0	Send Mouse X & Y on button press and release. See the section Mouse Tracking.
                        1 0 0 1	Use Hilite Mouse Tracking.
                        1 0 0 2	Use Cell Motion Mouse Tracking.
                        1 0 0 3	Use All Motion Mouse Tracking.
                        1 0 1 0	Scroll to bottom on tty output [rxvt].
                        1 0 1 1	Scroll to bottom on key press [rxvt].
                        1 0 3 5	Enable special modifiers for Alt and NumLock keys.
                        1 0 3 6	Send ESC when Meta modifies a key (enables the metaSendsEscaperesource).
                        1 0 3 7	Send DEL from the editing-keypad Delete key
                        1 0 4 7	Use Alternate Screen Buffer (unless disabled by the titleInhibit resource)
                        1 0 4 8	Save cursor as in DECSC (unless disabled by the titleinhibit resource)
                        1 0 4 9	Save cursor as in DECSC and use Alternate Screen Buffer, clearing it first (unless disabled by the titleinhibit resource)
                        1 0 5 1	Set Sun function-key mode.
                        1 0 5 2	Set HP function-key mode.
                        1 0 6 0	Set legacy keyboard emulation (X11R6).
                        1 0 6 1	Set Sun/PC keyboard emulation of VT220 keyboard.

CSI ? Pm l	DECRST	DEC Private Mode Reset)
                        1	Normal Cursor Keys DECCKM
                        2	Designate VT52 mode (DECANM).
                        3	80 Column Mode (DECCOLM)
                        4	Jump (Fast) Scroll (DECSCLM)
                        5	Normal Video (DECSCNM)
                        6	Normal Cursor Mode (DECOM)
                        7	No Wraparound Mode (DECAWM)
                        8	No Auto-repeat Keys (DECARM)
                        9	Don't Send Mouse X & Y on button press
                        1 8	Don't print form feed (DECPFF)
                        1 9	Limit print to scrolling region (DECPEX)
                        2 5	Hide Cursor (DECTCEM)
                        3 0	Don't show scrollbar (rxvt).
                        3 5	Disable shifted key-functions (rxvt).
                        4 0	Disallow 80 <-> 132 Mode
                        4 1	No more(1) fix (see curses resource)
                        4 2	Disable Nation Replacement Character sets (DECNRCM)
                        4 4	Turn Off Margin Bell
                        4 5	No Reverse-wraparound Mode
                        4 6	Stop Logging (normally disabled by a compile-time option)
                        4 7	Use Normal Screen Buffer
                        6 6	Numeric keypad (DECNKM)
                        6 7	Backarrow key sends backspace (DECBKM)
                        1 0 0 0	Don't Send Mouse X & Y on button press and release. See the section Mouse Tracking.
                        1 0 0 1	Don't Use Hilite Mouse Tracking
                        1 0 0 2	Don't Use Cell Motion Mouse Tracking
                        1 0 0 3	Don't Use All Motion Mouse Tracking
                        1 0 1 0	Don't scroll to bottom on tty output (rxvt).
                        1 0 1 1	Don't scroll to bottom on key press (rxvt).
                        1 0 3 5	Disable special modifiers for Alt and NumLock keys.
                        1 0 3 6	Don't send ESC when Meta modifies a key (disables the metaSendsEscape resource).
                        1 0 3 7	Send VT220 Remove from the editing- keypad Delete key
                        1 0 4 7	Use Normal Screen Buffer, clearing screen first if in the Alternate Screen (unless disabled by the titleinhibit resource)
                        1 0 4 8	Restore cursor as in DECRC (unless disabled by the titleinhibit resource)
                        1 0 4 9	Use Normal Screen Buffer and restore cursor as in DECRC (unless disabled by the titleinhibit resource)
                        1 0 5 1	Reset Sun function-key mode.
                        1 0 5 2	Reset HP function-key mode.
                        1 0 6 0	Reset legacy keyboard emulation (X11R6).
                        1 0 6 1	Reset Sun/PC keyboard emulation of VT220 keyboard.


CSI Pm i	MC	Media Copy)

                        0	Print screen (default)
                        4	Turn off printer controller mode
                        5	Turn on printer controller mode

CSI ? Pm i	MC, DEC-specific	Media Copy)
                        1	Print line containing cursor
                        4	Turn off autoprint mode
                        5	Turn on autoprint mode
                        1 0	Print composed display, ignores DECPEX
                        1 1	Print all pages


CSI Pm m	SGR	Character Attributes)
 	
        0	Normal (default)
        1	Bold
        4	Underlined
        5	Blink (appears as Bold)
        7	Inverse
        8	Invisible (hidden)
        2 2	Normal (neither bold nor faint)
        2 4	Not underlined
        2 5	Steady (not blinking)
        2 7	Positive (not inverse)
        2 8	Visible (not hidden)
        3 0	Set foreground color to Black
        3 1	Set foreground color to Red
        3 2	Set foreground color to Green
        3 3	Set foreground color to Yellow
        3 4	Set foreground color to Blue
        3 5	Set foreground color to Magenta
        3 6	Set foreground color to Cyan
        3 7	Set foreground color to White
        3 9	Set foreground color to default (original)
        4 0	Set background color to Black
        4 1	Set background color to Red
        4 2	Set background color to Green
        4 3	Set background color to Yellow
        4 4	Set background color to Blue
        4 5	Set background color to Magenta
        4 6	Set background color to Cyan
        4 7	Set background color to White
        4 9	Set background color to default (original).
        9 0	Set foreground color to Black
        9 1	Set foreground color to Red
        9 2	Set foreground color to Green
        9 3	Set foreground color to Yellow
        9 4	Set foreground color to Blue
        9 5	Set foreground color to Magenta
        9 6	Set foreground color to Cyan
        9 7	Set foreground color to White
        1 0 0	Set background color to Black
        1 0 1	Set background color to Red
        1 0 2	Set background color to Green
        1 0 3	Set background color to Yellow
        1 0 4	Set background color to Blue
        1 0 5	Set background color to Magenta
        1 0 6	Set background color to Cyan
        1 0 7	Set background color to White
        If 88- or 256-color support is compiled, the following apply.
        3 8 ; 5 ; Ps	Set background color to Ps
        4 8 ; 5 ; Ps	Set foreground color to Ps

CSI Ps n	DSR	Device Status Report)
                        5	Status Report CSI 0 n (``OK'')
                        6	Report Cursor Position (CPR) [row;column] as CSI r ; c R

CSI ? Ps n	DSR, DEC-specific	Device Status Report
                6	Report Cursor Position (CPR) [row;column] as CSI ? r ; c R (assumes page is zero).
                1 5	Report Printer status as CSI ? 1 0 n (ready) or CSI ? 1 1 n (not ready)
                2 5	Report UDK status as CSI ? 2 0 n (unlocked) or CSI ? 2 1 n (locked)
                2 6	Report Keyboard status as:
                        CSI ? 2 7 ; 1 ; 0 ; 0 n (North American)
                        CSI ? 5 3 n Locator available, if compiled-in, or
                        CSI ? 5 0 n No Locator, if not.
CSI ! p	DECSTR	Soft terminal reset
CSI Ps ; Ps " p	Set conformance level DECSCL
                Valid values for the first parameter
                6 1	VT100
                6 2	VT200
                6 3	VT300
                        
                Valid values for the second parameter
                0	8-bit controls
                1	7-bit controls (always set for VT100)
                2	8-bit controls

CSI Pt ; Pl ; Pb ; Pr ` w	DECEFR	Enable Filter Rectangle
                                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 Ps x	DECREQTPARM	Request Terminal Parameters)
CSI Ps ; Pu ` z	DECELR	Enable Locator Reporting
                The first parameter
                0	Locator disabled (default)
                1	Locator enabled
                2	Locator enabled for one report, then disabled
                The second parameter specifies the coordinate unit for locator reports.
                0 or omitted	default to character cells
                1	device physical pixels
                2	character cells

CSI Pm ` {	DECSLE	Select Locator Events
                Valid values for the first (and any additional parameters) are:
                0	only respond to explicit host requests DECRQLP (default) also cancels any filter rectangle
                1	report button down transitions
                2	do not report button down transitions
                3	report button up transitions
                4	do not report button up transitions

CSI Ps ` |	DECRQLP	Request Locator Position
                Valid values for the parameter are:
                0 , 1 or omitted	transmit a single DECLRP locator 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 rectangles have been enabled with a DECEFR.

CSI Pe ; Pb ; Pr ; Pc ; Pp & w	DECLRP	Locator Report
                                Parameters are [event;button;row;column;page].
                                Valid values for the event (Pe):
                                0	locator unavailable - no other parameters sent
                                1	request - xterm received a DECRQLP
                                2	left button down
                                3	left button up
                                4	middle button down
                                5	middle button up
                                6	right button down
                                7	right button up
                                8	M4 button down
                                9	M4 button up
                                1 0	locator outside filter rectangle
                                ``button'' parameter (Pb) is a bitmask indicating which buttons are pressed:
                                == 0	no buttons down
                                & 1	right button down
                                & 2	middle button down
                                & 4	left button down
                                & 8	M4 button down
                                ``row'' and ``column'' parameters (Pr, Pc) are the coordinates of the locator position in the xterm window, encoded as ASCII decimal.
                                The ``page'' parameter (Pp) is not used by xterm, and will be omitted.

# Operating System Controls
OSC Ps ; Pt ST	Set Text Parameters. For colors and font, if Pt is a "?", the control sequence elicits a response which consists of the control sequence which would set the corresponding value. The dtterm control sequences allow you to determine the icon name and window title.
OSC Ps ; Pt BEL
            0	Change Icon Name and Window Title to Pt
            1	Change Icon Name to Pt
            2	Change Window Title to Pt
            3	Set X property on top-level window. Pt should be in the form "prop=value", or just "prop" to delete the property
            4 ; c ; name	Change Color #c to cname. Any number of c name pairs may be given.
            1 0	Change color names starting with text foreground to Pt (a list of one or more color names or RGB specifications, separated by semicolon, up to eight, as per XParseColor).
            1 1	Change colors starting with text background to Pt
            1 2	Change colors starting with text cursor to Pt
            1 3	Change colors starting with mouse foreground to Pt
            1 4	Change colors starting with mouse background to Pt
            1 5	Change colors starting with Tek foreground to Pt
            1 6	Change colors starting with Tek background to Pt
            1 7	Change colors starting with highlight to Pt
            4 6	Change Log File to Pt (normally disabled by a compile-time option)
            5 0	Set Font to Pt 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).



======================================================= Mouse ================
Mouse Tracking

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 Ps ; Ps 'z control sequence, and is not described here. The remaining five modes are each enabled (or disabled) by a different parameter in DECSET CSI ? Pm h or DECRST CSI ? Pm l con- trol 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
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.

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.
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 CSI M CbCxCy (6 characters). Cb is button-1. Cx and Cy 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, xterm sends CSI M CbCxCy. The low two bits of Cb 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 xterm uses the control modifier with mouse for popup menus, and the shift modifier is used in the default translations for button events. The Meta modifier recognized by xterm is the mod1 mask, and is not nec- essarily the "Meta" key (see xmodmap). Cx and Cy 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 adding 64 to the event code.
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. Warning: use of this mode requires a coop- erating program or it will hang xterm. On button press, the same infor- mation 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: CSI Ps ; Ps ; Ps ; Ps ; Ps T . The parameters are func, startx, starty, firstrow, and lastrow. func is non-zero to initiate hilite tracking and zero to abort. startx and starty give the starting x and y location for the highlighted region. The ending location tracks the mouse, but will never be above row firstrow and will always be above row lastrow. (The top of the screen is row 1.) When the button is released, xterm reports the ending position one of two ways: if the start and end coordinates are valid text locations: CSI t CxCy. If either coordinate is past the end of the line: CSI T CxCyCxCyCxCy. The parameters are startx, starty, endx, endy, mousex, and mousey. startx, starty, endx, and endy give the starting and ending character positions of the region. mousex and mousey give the 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 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. On button-motion events, xterm adds 32 to the event code (the third charac- ter, Cb). 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 @ CxCy. ( @ = 32 + 0 (button 1) + 32 (motion indicator) ). Similarly, motion with button 3 down is reported as CSI M B CxCy. ( 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 instead of just those that enter a new character cell. It is enabled by specifying 1003 to DECSET.


