File: xterm.ctrl

package info (click to toggle)
et 80b2-8
  • links: PTS
  • area: main
  • in suites: potato, slink
  • size: 1,068 kB
  • ctags: 1,074
  • sloc: ansic: 10,313; tcl: 2,633; makefile: 179; sh: 19
file content (500 lines) | stat: -rw-r--r-- 18,187 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
From vbica@qualcomm.com Tue Mar 14 17:54:24 EST 1995
Article: 80223 of comp.windows.x
Xref: world comp.windows.x:80223
Path: world!news.mathworks.com!solaris.cc.vt.edu!hookup!swrinde!ihnp4.ucsd.edu!qualcomm.com!vbica-mac.qualcomm.com!user
From: vbica@qualcomm.com (Vito Bica)
Newsgroups: comp.windows.x
Subject: Re: xterm escape code sequences
Date: 14 Mar 1995 14:38:36 GMT
Organization: Qualcomm.com
Lines: 486
Message-ID: <vbica-1403950638350001@vbica-mac.qualcomm.com>
References: <Insert-1303950704030001@vbica-mac.qualcomm.com>
NNTP-Posting-Host: vbica-mac.qualcomm.com

In article <Insert-1303950704030001@vbica-mac.qualcomm.com>, Vito Bica
(vbica@qualcomm.com) wrote:

> I'm looking for the list of xterm escape code sequences that are used to
> control xterm display characteristics.  These sequences allow you to do
> things like change the title at the top of the window on the fly.  The man
> pages for xterm say to look in the source directory for xterm, which I
> don't have.  Any help would be appreciated.  Thanks in advance!
> 
> Vito Bica
> vbica@qualcomm.com

FYI to others who need this info, I got two replies.  Thanks for the help!


--

   In order to set the title of xterm you should use:

       echo -n "<ESC>]2;<string><BELL>"

   Where <ESC> is the Esacpae character,
         <string> is the desired title
   and   <BELL> is ^G

Gil

-----------------------------------------------------------------------------
Gil Bregman                                   Applicom Systems, Ltd.
Email : gil@applicom.co.il                    39 Ha-Galim Boulevard
Phone : +972-9-598-679                        Merkazim Building 2001
Fax   : +972-9-598-990                        P.O. Box 2016
WWW: http://www.applicom.co.il/~gil           Herzliya 46120, ISRAEL
-----------------------------------------------------------------------------

Reply #2:

I've formatted the pages with nroff.  You may want to use ftp to fetch
the original document ctlseqs.ms to get a prettier printout.

>>>=================== ctlseqs.ms ====================================








                          Xterm Control Sequences


                                 Edward Moy

                     University of California, Berkeley

                                 Revised by


                               Stephen Gildea

                                X Consortium






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).

Pt   A text parameter composed of printable characters.

VT100 Mode


Most of these control sequences are standard VT102  control  sequences,  but
there  are  some  sequences  here  from  later DEC VT terminals, too.  VT102

features not supported are smooth scrolling, double size characters,  blink-
ing  characters,  and  VT52 mode.  There are additional control sequences to

provide xterm-dependent functions, like the scrollbar or window size.  Where
the  function  is  specified  by DEC or ISO 6429, the code assigned to it is

given in parentheses.  The escape codes to designate  and  invoke  character
sets  are specified by ISO 2022; see that document for a discussion of char-

acter sets.
BEL            Bell (Ctrl-G)

BS             Backspace (Ctrl-H)
TAB            Horizontal Tab (HT) (Ctrl-I)

LF             Line Feed or New Line (NL) (Ctrl-J)
VT             Vertical Tab (Ctrl-K) same as LF

FF             Form Feed or New Page (NP) (Ctrl-L) same as LF
CR             Carriage Return (Ctrl-M)

SO             Shift Out (Ctrl-N) ->  Switch  to  Alternate  Character  Set:
               invokes the G1 character set.

SI             Shift In  (Ctrl-O)  ->  Switch  to  Standard  Character  Set:
               invokes the G0 character set (the default).

ESC # 8        DEC Screen Alignment Test (DECALN)
ESC ( C        Designate G0 Character Set (ISO 2022)

                 C = 0  -> DEC Special Character and Line Drawing Set
                 C = A  -> United Kingdom (UK)

                 C = B  -> United States (USASCII)
ESC ) C        Designate G1 Character Set (ISO 2022)

                 C = 0  -> DEC Special Character and Line Drawing Set
                 C = A  -> United Kingdom (UK)

                 C = B  -> United States (USASCII)
ESC * C        Designate G2 Character Set (ISO 2022)

                 C = 0  -> DEC Special Character and Line Drawing Set
                 C = A  -> United Kingdom (UK)

                 C = B  -> United States (USASCII)
ESC + C        Designate G3 Character Set (ISO 2022)

                 C = 0  -> DEC Special Character and Line Drawing Set
                 C = A  -> United Kingdom (UK)

                 C = B  -> United States (USASCII)
ESC 7          Save Cursor (DECSC)

ESC 8          Restore Cursor (DECRC)
ESC =          Application Keypad (DECPAM)

ESC >          Normal Keypad (DECPNM)
ESC D          Index (IND)

ESC E          Next Line (NEL)
ESC F          Cursor to lower left corner of  screen  (if  enabled  by  the

               hpLowerleftBugCompat resource).
ESC H          Tab Set (HTS)

ESC M          Reverse Index (RI)
ESC N          Single Shift Select of G2 Character Set (SS2):  affects  next

               character only
ESC O          Single Shift Select of G3 Character Set (SS3):  affects  next

               character only
ESC P Pt ESC \ Device Control String (DCS)

                 xterm implements no DCS functions; Pt is ignored.  Pt  need
               not be printable characters.

ESC Z          Return Terminal ID (DECID).  Obsolete form of ESC [ c  (DA).
ESC [ Ps @     Insert Ps (Blank) Character(s) (default = 1) (ICH)

ESC [ Ps A     Cursor Up Ps Times (default = 1) (CUU)
ESC [ Ps B     Cursor Down Ps Times (default = 1) (CUD)

ESC [ Ps C     Cursor Forward Ps Times (default = 1) (CUF)
ESC [ Ps D     Cursor Backward Ps Times (default = 1) (CUB)

ESC [ Ps ; Ps H Cursor Position [row;column] (default = [1,1]) (CUP)
ESC [ Ps J     Erase in Display (ED)

                 Ps = 0  -> Clear Below (default)
                 Ps = 1  -> Clear Above

                 Ps = 2  -> Clear All
ESC [ Ps K     Erase in Line (EL)

                 Ps = 0  -> Clear to Right (default)
                 Ps = 1  -> Clear to Left

                 Ps = 2  -> Clear All
ESC [ Ps L     Insert Ps Line(s) (default = 1) (IL)

ESC [ Ps M     Delete Ps Line(s) (default = 1) (DL)
ESC [ Ps P     Delete Ps Character(s) (default = 1) (DCH)

ESC [ Ps ; Ps ; Ps ; Ps ; Ps T
               Initiate   hilite    mouse    tracking.     Parameters    are

               [func;startx;starty;firstrow;lastrow].  See the section Mouse
               Tracking.

ESC [ Ps c     Send Device Attributes (DA)
                 Ps = 0  or omitted -> request attributes from terminal

                 -> ESC [ ? 1 ; 2 c  (``I am a  VT100  with  Advanced  Video
               Option.'')

ESC [ Ps ; Ps f Horizontal and Vertical  Position  [row;column]  (default  =
               [1,1]) (HVP)

ESC [ Ps g     Tab Clear (TBC)
                 Ps = 0  -> Clear Current Column (default)

                 Ps = 3  -> Clear All
ESC [ Pm h     Set Mode (SM)

                 Ps = 4  -> Insert Mode (IRM)
                 Ps = 2 0  -> Automatic Newline (LNM)

ESC [ Pm l     Reset Mode (RM)
                 Ps = 4  -> Replace Mode (IRM)

                 Ps = 2 0  -> Normal Linefeed (LNM)
ESC [ Pm m     Character Attributes (SGR)

                 Ps = 0  -> Normal (default)
                 Ps = 1  -> Bold

                 Ps = 4  -> Underscore
                 Ps = 5  -> Blink (appears as Bold)

                 Ps = 7  -> Inverse
ESC [ Ps n     Device Status Report (DSR)

                 Ps = 5  -> Status Report ESC [ 0 n  (``OK'')
                 Ps = 6  -> Report Cursor Position (CPR) [row;column] as ESC

               [ r ; c R
ESC [ Ps ; Ps r Set Scrolling Region [top;bottom] (default =  full  size  of

               window) (DECSTBM)
ESC [ Ps x     Request Terminal Parameters (DECREQTPARM)

ESC [ ? Pm h   DEC Private Mode Set (DECSET)
                 Ps = 1  -> Application Cursor Keys (DECCKM)

                 Ps = 2  -> Designate USASCII for character sets G0-G3.  (In
               the  VT102,  this  selects  VT52  mode  (DECANM), which xterm

               doesn't support.)
                 Ps = 3  -> 132 Column Mode (DECCOLM)

                 Ps = 4  -> Smooth (Slow) Scroll (DECSCLM)
                 Ps = 5  -> Reverse Video (DECSCNM)

                 Ps = 6  -> Origin Mode (DECOM)
                 Ps = 7  -> Wraparound Mode (DECAWM)

                 Ps = 8  -> Auto-repeat Keys (DECARM)
                 Ps = 9  -> Send Mouse X & Y on button press.  See the  sec-

               tion Mouse Tracking.
                 Ps = 3 8  -> Enter Tektronix Mode (DECTEK)

                 Ps = 4 0  -> Allow 80 -> 132 Mode
                 Ps = 4 1  -> more(1) fix (see curses resource)

                 Ps = 4 4  -> Turn On Margin Bell
                 Ps = 4 5  -> Reverse-wraparound Mode

                 Ps =  4  6   ->  Start  Logging  (normally  disabled  by  a
               compile-time option)

                 Ps = 4 7  -> Use Alternate Screen Buffer  (unless  disabled
               by the titeInhibit resource)

                 Ps = 1 0 0 0  -> Send Mouse X  &  Y  on  button  press  and
               release.  See the section Mouse Tracking.

                 Ps = 1 0 0 1  -> Use Hilite Mouse Tracking.  See  the  sec-
               tion Mouse Tracking.

ESC [ ? Pm l   DEC Private Mode Reset (DECRST)
                 Ps = 1  -> Normal Cursor Keys (DECCKM)

                 Ps = 3  -> 80 Column Mode (DECCOLM)
                 Ps = 4  -> Jump (Fast) Scroll (DECSCLM)

                 Ps = 5  -> Normal Video (DECSCNM)
                 Ps = 6  -> Normal Cursor Mode (DECOM)

                 Ps = 7  -> No Wraparound Mode (DECAWM)
                 Ps = 8  -> No Auto-repeat Keys (DECARM)

                 Ps = 9  -> Don't Send Mouse X & Y on button press
                 Ps = 4 0  -> Disallow 80 -> 132 Mode

                 Ps = 4 1  -> No more(1) fix (see curses resource)
                 Ps = 4 4  -> Turn Off Margin Bell

                 Ps = 4 5  -> No Reverse-wraparound Mode
                 Ps = 4 6  -> Stop Logging (normally disabled by a  compile-

               time option)
                 Ps = 4 7  -> Use Normal Screen Buffer

                 Ps = 1 0 0 0  -> Don't Send Mouse X & Y on button press and
               release

                 Ps = 1 0 0 1  -> Don't Use Hilite Mouse Tracking
ESC [ ? Pm r   Restore DEC Private Mode Values.  The value of Ps  previously

               saved is restored.  Ps values are the same as for DECSET.
ESC [ ? Pm s   Save DEC Private Mode Values.  Ps values are the same as  for

               DECSET.
ESC ] Ps ; Pt BEL

               Set Text Parameters
                 Ps = 0  -> Change Icon Name and Window Title to Pt

                 Ps = 1  -> Change Icon Name to Pt
                 Ps = 2  -> Change Window Title to Pt

                 Ps = 4 6  -> Change Log File to Pt (normally disabled by  a
               compile-time option)

                 Ps = 5 0  -> Set Font to Pt
ESC ^ Pt ESC \ Privacy Message (PM)

                 xterm implements no PM functions; Pt is ignored.   Pt  need
               not be printable characters.

ESC _ Pt ESC \ Application Program Command (APC)
                 xterm implements no APC functions; Pt is ignored.  Pt  need

               not be printable characters.
ESC c          Full Reset (RIS)

ESC l          Memory Lock (per HP terminals).  Locks memory above the  cur-
               sor.

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 xterm.
ESC }          Invoke the G2 Character Set as GR  (LS2R).   Has  no  visible

               effect in xterm.
ESC ~          Invoke the G1 Character Set as GR  (LS1R).   Has  no  visible

               effect in xterm.

Mouse Tracking
The VT widget can be set to send the mouse position and other information on
button  presses.   These modes are typically used by editors and other full-
screen applications that want to make use of the mouse.

There are three mutually exclusive modes, each enabled (or  disabled)  by  a
different  parameter  in the DECSET (or DECRST) escape sequence.  Parameters
for all mouse tracking escape sequences generated by  xterm  encode  numeric
parameters  in  a single character as value+040.  For example, !  is 1.  The
screen coodinate system is 1-based.
X10 compatibility mode sends an escape sequence on button press encoding the
location  and the mouse button pressed.  It is enabled by specifying parame-
ter 9 to DECSET.  On button press, xterm sends ESC [  M  CbCxCy  (6  charac-
ters).   Cb is button-1.  Cx and Cy are the x and y coordinates of the mouse
when the button was pressed.

Normal tracking mode sends an escape  sequence  on  both  button  press  and
release.   Modifier  information  is also sent.  It is enabled by specifying
parameter 1000 to DECSET.  On button press or release, xterm sends ESC  [  M
CbCxCy.   The  low two bits of Cb encode button information:  0=MB1 pressed,
1=MB2 pressed, 2=MB3 pressed, 3=release.  The upper bits encode what  modif-
iers were down when the button was pressed and are added together.  4=Shift,
8=Meta, 16=Control.  Cx and Cy are the x and  y  coordinates  of  the  mouse
event.  The upper left corner is (1,1).
Mouse hilite tracking notifies a program of a button press, receives a range
of lines from the program, highlights the region covered by the mouse within
that range until button release, and then  sends  the  program  the  release
coordinates.   It  is enabled by specifying parameter 1001 to DECSET.  Warn-
ing: 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:  ESC [ 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:  ESC [ t CxCy.  If either coordinate is past the end of the
line:  ESC [ 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  loca-
tion of the mouse at button up, which may not be over a character.

Tektronix 4014 Mode

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-thru 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 xterm) (ESC Ctrl-N)

ESC SI         End 4015 APL mode (ignored by xterm) (ESC Ctrl-O)
ESC ETB        COPY (Save Tektronix  Codes  to  file  COPYyy-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

ESC ] Ps ; Pt BEL
               Set Text Parameters of VT window

                 Ps = 0  -> Change Icon Name and Window Title to Pt
                 Ps = 1  -> Change Icon Name to Pt

                 Ps = 2  -> Change Window Title to Pt
                 Ps = 4 6  -> Change Log File to Pt (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-_)
===================================================================<<<
-- 
Pete Forman
Western Geophysical
pete.forman@bedford.waii.com

-- 
Vito Bica
vbica@qualcomm.com