1 |
Xterm Control Sequences |
2 |
|
3 |
Edward Moy |
4 |
|
5 |
University of California, Berkeley |
6 |
|
7 |
Revised by |
8 |
|
9 |
Stephen Gildea |
10 |
|
11 |
X Consortium |
12 |
|
13 |
Definitions |
14 |
|
15 |
c The literal character c. |
16 |
|
17 |
C A single (required) character. |
18 |
|
19 |
Ps A single (usually optional) numeric parameter, composed of one of more |
20 |
digits. |
21 |
|
22 |
Pm A multiple numeric parameter composed of any number of single numeric |
23 |
parameters, separated by ; character(s). |
24 |
|
25 |
Pt A text parameter composed of printable characters. |
26 |
|
27 |
VT100 Mode |
28 |
|
29 |
Most of these control sequences are standard VT102 control sequences, but |
30 |
there are some sequences here from later DEC VT terminals, too. VT102 |
31 |
features not supported are smooth scrolling, double size characters, blink- |
32 |
ing characters, and VT52 mode. There are additional control sequences to |
33 |
provide xterm-dependent functions, like the scrollbar or window size. Where |
34 |
the function is specified by DEC or ISO 6429, the code assigned to it is |
35 |
given in parentheses. The escape codes to designate and invoke character |
36 |
sets are specified by ISO 2022; see that document for a discussion of char- |
37 |
acter sets. |
38 |
BEL Bell (Ctrl-G) |
39 |
BS Backspace (Ctrl-H) |
40 |
TAB Horizontal Tab (HT) (Ctrl-I) |
41 |
LF Line Feed or New Line (NL) (Ctrl-J) |
42 |
VT Vertical Tab (Ctrl-K) same as LF |
43 |
FF Form Feed or New Page (NP) (Ctrl-L) same as LF |
44 |
CR Carriage Return (Ctrl-M) |
45 |
SO Shift Out (Ctrl-N) -> Switch to Alternate Character Set: |
46 |
invokes the G1 character set. |
47 |
SI Shift In (Ctrl-O) -> Switch to Standard Character Set: |
48 |
invokes the G0 character set (the default). |
49 |
ESC # 8 DEC Screen Alignment Test (DECALN) |
50 |
ESC ( C Designate G0 Character Set (ISO 2022) |
51 |
C = 0 -> DEC Special Character and Line Drawing Set |
52 |
C = A -> United Kingdom (UK) |
53 |
C = B -> United States (USASCII) |
54 |
ESC ) C Designate G1 Character Set (ISO 2022) |
55 |
C = 0 -> DEC Special Character and Line Drawing Set |
56 |
C = A -> United Kingdom (UK) |
57 |
C = B -> United States (USASCII) |
58 |
ESC * C Designate G2 Character Set (ISO 2022) |
59 |
C = 0 -> DEC Special Character and Line Drawing Set |
60 |
C = A -> United Kingdom (UK) |
61 |
C = B -> United States (USASCII) |
62 |
ESC + C Designate G3 Character Set (ISO 2022) |
63 |
C = 0 -> DEC Special Character and Line Drawing Set |
64 |
C = A -> United Kingdom (UK) |
65 |
C = B -> United States (USASCII) |
66 |
ESC 7 Save Cursor (DECSC) |
67 |
ESC 8 Restore Cursor (DECRC) |
68 |
ESC = Application Keypad (DECPAM) |
69 |
ESC > Normal Keypad (DECPNM) |
70 |
ESC D Index (IND) |
71 |
ESC E Next Line (NEL) |
72 |
ESC F Cursor to lower left corner of screen (if enabled by the |
73 |
hpLowerleftBugCompat resource). |
74 |
ESC H Tab Set (HTS) |
75 |
ESC M Reverse Index (RI) |
76 |
ESC N Single Shift Select of G2 Character Set (SS2): affects next |
77 |
character only |
78 |
ESC O Single Shift Select of G3 Character Set (SS3): affects next |
79 |
character only |
80 |
ESC P Pt ESC \ Device Control String (DCS) |
81 |
xterm implements no DCS functions; Pt is ignored. Pt need |
82 |
not be printable characters. |
83 |
ESC Z Return Terminal ID (DECID). Obsolete form of ESC [ c (DA). |
84 |
ESC [ Ps @ Insert Ps (Blank) Character(s) (default = 1) (ICH) |
85 |
ESC [ Ps A Cursor Up Ps Times (default = 1) (CUU) |
86 |
ESC [ Ps B Cursor Down Ps Times (default = 1) (CUD) |
87 |
ESC [ Ps C Cursor Forward Ps Times (default = 1) (CUF) |
88 |
ESC [ Ps D Cursor Backward Ps Times (default = 1) (CUB) |
89 |
ESC [ Ps ; Ps H Cursor Position [row;column] (default = [1,1]) (CUP) |
90 |
ESC [ Ps J Erase in Display (ED) |
91 |
Ps = 0 -> Clear Below (default) |
92 |
Ps = 1 -> Clear Above |
93 |
Ps = 2 -> Clear All |
94 |
ESC [ Ps K Erase in Line (EL) |
95 |
Ps = 0 -> Clear to Right (default) |
96 |
Ps = 1 -> Clear to Left |
97 |
Ps = 2 -> Clear All |
98 |
ESC [ Ps L Insert Ps Line(s) (default = 1) (IL) |
99 |
ESC [ Ps M Delete Ps Line(s) (default = 1) (DL) |
100 |
ESC [ Ps P Delete Ps Character(s) (default = 1) (DCH) |
101 |
ESC [ Ps ; Ps ; Ps ; Ps ; Ps T |
102 |
Initiate hilite mouse tracking. Parameters are |
103 |
[func;startx;starty;firstrow;lastrow]. See the section Mouse |
104 |
Tracking. |
105 |
ESC [ Ps c Send Device Attributes (DA) |
106 |
Ps = 0 or omitted -> request attributes from terminal |
107 |
-> ESC [ ? 1 ; 2 c (``I am a VT100 with Advanced Video |
108 |
Option.'') |
109 |
ESC [ Ps ; Ps f Horizontal and Vertical Position [row;column] (default = |
110 |
[1,1]) (HVP) |
111 |
ESC [ Ps g Tab Clear (TBC) |
112 |
Ps = 0 -> Clear Current Column (default) |
113 |
Ps = 3 -> Clear All |
114 |
ESC [ Pm h Set Mode (SM) |
115 |
Ps = 4 -> Insert Mode (IRM) |
116 |
Ps = 2 0 -> Automatic Newline (LNM) |
117 |
ESC [ Pm l Reset Mode (RM) |
118 |
Ps = 4 -> Replace Mode (IRM) |
119 |
Ps = 2 0 -> Normal Linefeed (LNM) |
120 |
ESC [ Pm m Character Attributes (SGR) |
121 |
Ps = 0 -> Normal (default) |
122 |
Ps = 1 -> Bold |
123 |
Ps = 4 -> Underscore |
124 |
Ps = 5 -> Blink (appears as Bold) |
125 |
Ps = 7 -> Inverse |
126 |
ESC [ Ps n Device Status Report (DSR) |
127 |
Ps = 5 -> Status Report ESC [ 0 n (``OK'') |
128 |
Ps = 6 -> Report Cursor Position (CPR) [row;column] as ESC |
129 |
[ r ; c R |
130 |
ESC [ Ps ; Ps r Set Scrolling Region [top;bottom] (default = full size of |
131 |
window) (DECSTBM) |
132 |
ESC [ Ps x Request Terminal Parameters (DECREQTPARM) |
133 |
ESC [ ? Pm h DEC Private Mode Set (DECSET) |
134 |
Ps = 1 -> Application Cursor Keys (DECCKM) |
135 |
Ps = 2 -> Designate USASCII for character sets G0-G3. (In |
136 |
the VT102, this selects VT52 mode (DECANM), which xterm |
137 |
doesn't support.) |
138 |
Ps = 3 -> 132 Column Mode (DECCOLM) |
139 |
Ps = 4 -> Smooth (Slow) Scroll (DECSCLM) |
140 |
Ps = 5 -> Reverse Video (DECSCNM) |
141 |
Ps = 6 -> Origin Mode (DECOM) |
142 |
Ps = 7 -> Wraparound Mode (DECAWM) |
143 |
Ps = 8 -> Auto-repeat Keys (DECARM) |
144 |
Ps = 9 -> Send Mouse X & Y on button press. See the sec- |
145 |
tion Mouse Tracking. |
146 |
Ps = 3 8 -> Enter Tektronix Mode (DECTEK) |
147 |
Ps = 4 0 -> Allow 80 <--> 132 Mode |
148 |
Ps = 4 1 -> more(1) fix (see curses resource) |
149 |
Ps = 4 4 -> Turn On Margin Bell |
150 |
Ps = 4 5 -> Reverse-wraparound Mode |
151 |
Ps = 4 6 -> Start Logging (normally disabled by a |
152 |
compile-time option) |
153 |
Ps = 4 7 -> Use Alternate Screen Buffer (unless disabled |
154 |
by the titeInhibit resource) |
155 |
Ps = 1 0 0 0 -> Send Mouse X & Y on button press and |
156 |
release. See the section Mouse Tracking. |
157 |
Ps = 1 0 0 1 -> Use Hilite Mouse Tracking. See the sec- |
158 |
tion Mouse Tracking. |
159 |
ESC [ ? Pm l DEC Private Mode Reset (DECRST) |
160 |
Ps = 1 -> Normal Cursor Keys (DECCKM) |
161 |
Ps = 3 -> 80 Column Mode (DECCOLM) |
162 |
Ps = 4 -> Jump (Fast) Scroll (DECSCLM) |
163 |
Ps = 5 -> Normal Video (DECSCNM) |
164 |
Ps = 6 -> Normal Cursor Mode (DECOM) |
165 |
Ps = 7 -> No Wraparound Mode (DECAWM) |
166 |
Ps = 8 -> No Auto-repeat Keys (DECARM) |
167 |
Ps = 9 -> Don't Send Mouse X & Y on button press |
168 |
Ps = 4 0 -> Disallow 80 <--> 132 Mode |
169 |
Ps = 4 1 -> No more(1) fix (see curses resource) |
170 |
Ps = 4 4 -> Turn Off Margin Bell |
171 |
Ps = 4 5 -> No Reverse-wraparound Mode |
172 |
Ps = 4 6 -> Stop Logging (normally disabled by a compile- |
173 |
time option) |
174 |
Ps = 4 7 -> Use Normal Screen Buffer |
175 |
Ps = 1 0 0 0 -> Don't Send Mouse X & Y on button press and |
176 |
release |
177 |
Ps = 1 0 0 1 -> Don't Use Hilite Mouse Tracking |
178 |
ESC [ ? Pm r Restore DEC Private Mode Values. The value of Ps previously |
179 |
saved is restored. Ps values are the same as for DECSET. |
180 |
ESC [ ? Pm s Save DEC Private Mode Values. Ps values are the same as for |
181 |
DECSET. |
182 |
ESC ] Ps ; Pt BEL |
183 |
Set Text Parameters |
184 |
Ps = 0 -> Change Icon Name and Window Title to Pt |
185 |
Ps = 1 -> Change Icon Name to Pt |
186 |
Ps = 2 -> Change Window Title to Pt |
187 |
Ps = 4 6 -> Change Log File to Pt (normally disabled by a |
188 |
compile-time option) |
189 |
Ps = 5 0 -> Set Font to Pt |
190 |
ESC ^ Pt ESC \ Privacy Message (PM) |
191 |
xterm implements no PM functions; Pt is ignored. Pt need |
192 |
not be printable characters. |
193 |
ESC _ Pt ESC \ Application Program Command (APC) |
194 |
xterm implements no APC functions; Pt is ignored. Pt need |
195 |
not be printable characters. |
196 |
ESC c Full Reset (RIS) |
197 |
ESC l Memory Lock (per HP terminals). Locks memory above the cur- |
198 |
sor. |
199 |
ESC m Memory Unlock (per HP terminals) |
200 |
ESC n Invoke the G2 Character Set (LS2) |
201 |
ESC o Invoke the G3 Character Set (LS3) |
202 |
ESC | Invoke the G3 Character Set as GR (LS3R). Has no visible |
203 |
effect in xterm. |
204 |
ESC } Invoke the G2 Character Set as GR (LS2R). Has no visible |
205 |
effect in xterm. |
206 |
ESC ~ Invoke the G1 Character Set as GR (LS1R). Has no visible |
207 |
effect in xterm. |
208 |
|
209 |
Mouse Tracking |
210 |
The VT widget can be set to send the mouse position and other information on |
211 |
button presses. These modes are typically used by editors and other full- |
212 |
screen applications that want to make use of the mouse. |
213 |
There are three mutually exclusive modes, each enabled (or disabled) by a |
214 |
different parameter in the DECSET (or DECRST) escape sequence. Parameters |
215 |
for all mouse tracking escape sequences generated by xterm encode numeric |
216 |
parameters in a single character as value+040. For example, ! is 1. The |
217 |
screen coodinate system is 1-based. |
218 |
X10 compatibility mode sends an escape sequence on button press encoding the |
219 |
location and the mouse button pressed. It is enabled by specifying parame- |
220 |
ter 9 to DECSET. On button press, xterm sends ESC [ M CbCxCy (6 charac- |
221 |
ters). Cb is button-1. Cx and Cy are the x and y coordinates of the mouse |
222 |
when the button was pressed. |
223 |
Normal tracking mode sends an escape sequence on both button press and |
224 |
release. Modifier information is also sent. It is enabled by specifying |
225 |
parameter 1000 to DECSET. On button press or release, xterm sends ESC [ M |
226 |
CbCxCy. The low two bits of Cb encode button information: 0=MB1 pressed, |
227 |
1=MB2 pressed, 2=MB3 pressed, 3=release. The upper bits encode what modif- |
228 |
iers were down when the button was pressed and are added together. 4=Shift, |
229 |
8=Meta, 16=Control. Cx and Cy are the x and y coordinates of the mouse |
230 |
event. The upper left corner is (1,1). |
231 |
Mouse hilite tracking notifies a program of a button press, receives a range |
232 |
of lines from the program, highlights the region covered by the mouse within |
233 |
that range until button release, and then sends the program the release |
234 |
coordinates. It is enabled by specifying parameter 1001 to DECSET. Warn- |
235 |
ing: use of this mode requires a cooperating program or it will hang xterm. |
236 |
On button press, the same information as for normal tracking is generated; |
237 |
xterm then waits for the program to send mouse tracking information. All X |
238 |
events are ignored until the proper escape sequence is received from the |
239 |
pty: ESC [ Ps ; Ps ; Ps ; Ps ; Ps T . The parameters are func, startx, |
240 |
starty, firstrow, and lastrow. func is non-zero to initiate hilite tracking |
241 |
and zero to abort. startx and starty give the starting x and y location for |
242 |
the highlighted region. The ending location tracks the mouse, but will |
243 |
never be above row firstrow and will always be above row lastrow. (The top |
244 |
of the screen is row 1.) When the button is released, xterm reports the |
245 |
ending position one of two ways: if the start and end coordinates are valid |
246 |
text locations: ESC [ t CxCy. If either coordinate is past the end of the |
247 |
line: ESC [ T CxCyCxCyCxCy. The parameters are startx, starty, endx, endy, |
248 |
mousex, and mousey. startx, starty, endx, and endy give the starting and |
249 |
ending character positions of the region. mousex and mousey give the loca- |
250 |
tion of the mouse at button up, which may not be over a character. |
251 |
|
252 |
Tektronix 4014 Mode |
253 |
Most of these sequences are standard Tektronix 4014 control sequences. |
254 |
Graph mode supports the 12-bit addressing of the Tektronix 4014. The major |
255 |
features missing are the write-thru and defocused modes. This document does |
256 |
not describe the commands used in the various Tektronix plotting modes but |
257 |
does describe the commands to switch modes. |
258 |
|
259 |
BEL Bell (Ctrl-G) |
260 |
BS Backspace (Ctrl-H) |
261 |
TAB Horizontal Tab (Ctrl-I) |
262 |
LF Line Feed or New Line (Ctrl-J) |
263 |
VT Cursor up (Ctrl-K) |
264 |
FF Form Feed or New Page (Ctrl-L) |
265 |
CR Carriage Return (Ctrl-M) |
266 |
ESC ETX Switch to VT100 Mode (ESC Ctrl-C) |
267 |
ESC ENQ Return Terminal Status (ESC Ctrl-E) |
268 |
ESC FF PAGE (Clear Screen) (ESC Ctrl-L) |
269 |
ESC SO Begin 4015 APL mode (ignored by xterm) (ESC Ctrl-N) |
270 |
ESC SI End 4015 APL mode (ignored by xterm) (ESC Ctrl-O) |
271 |
ESC ETB COPY (Save Tektronix Codes to file COPYyy-mm-dd.hh:mm:ss) |
272 |
(ESC Ctrl-W) |
273 |
ESC CAN Bypass Condition (ESC Ctrl-X) |
274 |
ESC SUB GIN mode (ESC Ctrl-Z) |
275 |
ESC FS Special Point Plot Mode (ESC Ctrl-\) |
276 |
ESC 8 Select Large Character Set |
277 |
ESC 9 Select #2 Character Set |
278 |
ESC : Select #3 Character Set |
279 |
ESC ; Select Small Character Set |
280 |
ESC ] Ps ; Pt BEL |
281 |
Set Text Parameters of VT window |
282 |
Ps = 0 -> Change Icon Name and Window Title to Pt |
283 |
Ps = 1 -> Change Icon Name to Pt |
284 |
Ps = 2 -> Change Window Title to Pt |
285 |
Ps = 4 6 -> Change Log File to Pt (normally disabled by a |
286 |
compile-time option) |
287 |
ESC ` Normal Z Axis and Normal (solid) Vectors |
288 |
ESC a Normal Z Axis and Dotted Line Vectors |
289 |
ESC b Normal Z Axis and Dot-Dashed Vectors |
290 |
ESC c Normal Z Axis and Short-Dashed Vectors |
291 |
ESC d Normal Z Axis and Long-Dashed Vectors |
292 |
ESC h Defocused Z Axis and Normal (solid) Vectors |
293 |
ESC i Defocused Z Axis and Dotted Line Vectors |
294 |
ESC j Defocused Z Axis and Dot-Dashed Vectors |
295 |
ESC k Defocused Z Axis and Short-Dashed Vectors |
296 |
ESC l Defocused Z Axis and Long-Dashed Vectors |
297 |
ESC p Write-Thru Mode and Normal (solid) Vectors |
298 |
ESC q Write-Thru Mode and Dotted Line Vectors |
299 |
ESC r Write-Thru Mode and Dot-Dashed Vectors |
300 |
ESC s Write-Thru Mode and Short-Dashed Vectors |
301 |
ESC t Write-Thru Mode and Long-Dashed Vectors |
302 |
FS Point Plot Mode (Ctrl-\) |
303 |
GS Graph Mode (Ctrl-]) |
304 |
RS Incremental Plot Mode (Ctrl-^) |
305 |
US Alpha Mode (Ctrl-_) |