]> git.ipfire.org Git - thirdparty/man-pages.git/blob - man4/console_codes.4
dsp56k.4: ffix
[thirdparty/man-pages.git] / man4 / console_codes.4
1 '\" t
2 .\" Copyright (c) 1996 Andries Brouwer <aeb@cwi.nl>, Mon Oct 31 22:13:04 1996
3 .\"
4 .\" %%%LICENSE_START(GPLv2+_DOC_ONEPARA)
5 .\" This is free documentation; you can redistribute it and/or
6 .\" modify it under the terms of the GNU General Public License as
7 .\" published by the Free Software Foundation; either version 2 of
8 .\" the License, or (at your option) any later version.
9 .\" %%%LICENSE_END
10 .\"
11 .\" This is combined from many sources.
12 .\" For Linux, the definitive source is of course console.c.
13 .\" About vt100-like escape sequences in general there are
14 .\" the ISO 6429 and ISO 2022 norms, the descriptions of
15 .\" an actual vt100, and the xterm docs (ctlseqs.ms).
16 .\" Substantial portions of this text are derived from a write-up
17 .\" by Eric S. Raymond <esr@thyrsus.com>.
18 .\"
19 .\" Tiny correction, aeb, 961107.
20 .\"
21 .\" 2006-05-27, Several corrections - Thomas E. Dickey
22 .\"
23 .TH CONSOLE_CODES 4 2020-02-09 "Linux" "Linux Programmer's Manual"
24 .SH NAME
25 console_codes \- Linux console escape and control sequences
26 .SH DESCRIPTION
27 The Linux console implements a large subset of the VT102 and ECMA-48/ISO
28 6429/ANSI X3.64 terminal controls, plus certain private-mode sequences
29 for changing the color palette, character-set mapping, and so on.
30 In the tabular descriptions below, the second column gives ECMA-48 or DEC
31 mnemonics (the latter if prefixed with DEC) for the given function.
32 Sequences without a mnemonic are neither ECMA-48 nor VT102.
33 .PP
34 After all the normal output processing has been done, and a
35 stream of characters arrives at the console driver for actual
36 printing, the first thing that happens is a translation from
37 the code used for processing to the code used for printing.
38 .PP
39 If the console is in UTF-8 mode, then the incoming bytes are
40 first assembled into 16-bit Unicode codes.
41 Otherwise, each byte is transformed according to the current mapping table
42 (which translates it to a Unicode value).
43 See the \fBCharacter Sets\fP section below for discussion.
44 .PP
45 In the normal case, the Unicode value is converted to a font index,
46 and this is stored in video memory, so that the corresponding glyph
47 (as found in video ROM) appears on the screen.
48 Note that the use of Unicode (and the design of the PC hardware)
49 allows us to use 512 different glyphs simultaneously.
50 .PP
51 If the current Unicode value is a control character, or we are
52 currently processing an escape sequence, the value will treated
53 specially.
54 Instead of being turned into a font index and rendered as
55 a glyph, it may trigger cursor movement or other control functions.
56 See the \fBLinux Console Controls\fP section below for discussion.
57 .PP
58 It is generally not good practice to hard-wire terminal controls into
59 programs.
60 Linux supports a
61 .BR terminfo (5)
62 database of terminal capabilities.
63 Rather than emitting console escape sequences by hand, you will almost
64 always want to use a terminfo-aware screen library or utility such as
65 .BR ncurses (3),
66 .BR tput (1),
67 or
68 .BR reset (1).
69 .SS Linux console controls
70 This section describes all the control characters and escape sequences
71 that invoke special functions (i.e., anything other than writing a
72 glyph at the current cursor location) on the Linux console.
73 .PP
74 .B "Control characters"
75 .PP
76 A character is a control character if (before transformation
77 according to the mapping table) it has one of the 14 codes
78 00 (NUL), 07 (BEL), 08 (BS), 09 (HT), 0a (LF), 0b (VT),
79 0c (FF), 0d (CR), 0e (SO), 0f (SI), 18 (CAN), 1a (SUB),
80 1b (ESC), 7f (DEL).
81 One can set a "display control characters" mode (see below),
82 and allow 07, 09, 0b, 18, 1a, 7f to be displayed as glyphs.
83 On the other hand, in UTF-8 mode all codes 00\(en1f are regarded
84 as control characters, regardless of any "display control characters"
85 mode.
86 .PP
87 If we have a control character, it is acted upon immediately
88 and then discarded (even in the middle of an escape sequence)
89 and the escape sequence continues with the next character.
90 (However, ESC starts a new escape sequence, possibly aborting a previous
91 unfinished one, and CAN and SUB abort any escape sequence.)
92 The recognized control characters are BEL, BS, HT, LF, VT, FF,
93 CR, SO, SI, CAN, SUB, ESC, DEL, CSI.
94 They do what one would expect:
95 .HP
96 BEL (0x07, \fB^G\fP) beeps;
97 .HP
98 BS (0x08, \fB^H\fP) backspaces one column
99 (but not past the beginning of the line);
100 .HP
101 HT (0x09, \fB^I\fP) goes to the next tab stop or to the end of the line
102 if there is no earlier tab stop;
103 .HP
104 LF (0x0A, \fB^J\fP), VT (0x0B, \fB^K\fP) and
105 FF (0x0C, \fB^L\fP) all give a linefeed,
106 and if LF/NL (new-line mode) is set also a carriage return;
107 .HP
108 CR (0x0D, \fB^M\fP) gives a carriage return;
109 .HP
110 SO (0x0E, \fB^N\fP) activates the G1 character set;
111 .HP
112 SI (0x0F, \fB^O\fP) activates the G0 character set;
113 .HP
114 CAN (0x18, \fB^X\fP) and SUB (0x1A, \fB^Z\fP) interrupt escape sequences;
115 .HP
116 ESC (0x1B, \fB^[\fP) starts an escape sequence;
117 .HP
118 DEL (0x7F) is ignored;
119 .HP
120 CSI (0x9B) is equivalent to ESC [.
121 .PP
122 .B "ESC- but not CSI-sequences"
123 .TS
124 l l l.
125 ESC c RIS Reset.
126 ESC D IND Linefeed.
127 ESC E NEL Newline.
128 ESC H HTS Set tab stop at current column.
129 ESC M RI Reverse linefeed.
130 ESC Z DECID T{
131 DEC private identification. The kernel
132 returns the string ESC [ ? 6 c, claiming
133 that it is a VT102.
134 T}
135 ESC 7 DECSC T{
136 Save current state (cursor coordinates,
137 attributes, character sets pointed at by G0, G1).
138 T}
139 ESC 8 DECRC Restore state most recently saved by ESC 7.
140 ESC [ CSI Control sequence introducer
141 ESC % Start sequence selecting character set
142 ESC % @ \0\0\0Select default (ISO 646 / ISO 8859-1)
143 ESC % G \0\0\0Select UTF-8
144 ESC % 8 \0\0\0Select UTF-8 (obsolete)
145 ESC # 8 DECALN DEC screen alignment test \- fill screen with E's.
146 ESC ( Start sequence defining G0 character set
147 ESC ( B \0\0\0Select default (ISO 8859-1 mapping)
148 ESC ( 0 \0\0\0Select VT100 graphics mapping
149 ESC ( U \0\0\0Select null mapping \- straight to character ROM
150 ESC ( K \0\0\0Select user mapping \- the map that is loaded by
151 \0\0\0the utility \fBmapscrn\fP(8).
152 ESC ) Start sequence defining G1
153 (followed by one of B, 0, U, K, as above).
154 ESC > DECPNM Set numeric keypad mode
155 ESC = DECPAM Set application keypad mode
156 ESC ] OSC T{
157 (Should be: Operating system command)
158 ESC ] P \fInrrggbb\fP: set palette, with parameter
159 given in 7 hexadecimal digits after the final P :-(.
160 Here \fIn\fP is the color (0\(en15), and \fIrrggbb\fP indicates
161 the red/green/blue values (0\(en255).
162 ESC ] R: reset palette
163 T}
164 .TE
165 .PP
166 .B "ECMA-48 CSI sequences"
167 .PP
168 CSI (or ESC [) is followed by a sequence of parameters,
169 at most NPAR (16), that are decimal numbers separated by
170 semicolons.
171 An empty or absent parameter is taken to be 0.
172 The sequence of parameters may be preceded by a single question mark.
173 .PP
174 However, after CSI [ (or ESC [ [) a single character is read
175 and this entire sequence is ignored.
176 (The idea is to ignore an echoed function key.)
177 .PP
178 The action of a CSI sequence is determined by its final character.
179 .TS
180 l l l.
181 @ ICH Insert the indicated # of blank characters.
182 A CUU Move cursor up the indicated # of rows.
183 B CUD Move cursor down the indicated # of rows.
184 C CUF Move cursor right the indicated # of columns.
185 D CUB Move cursor left the indicated # of columns.
186 E CNL Move cursor down the indicated # of rows, to column 1.
187 F CPL Move cursor up the indicated # of rows, to column 1.
188 G CHA Move cursor to indicated column in current row.
189 H CUP Move cursor to the indicated row, column (origin at 1,1).
190 J ED Erase display (default: from cursor to end of display).
191 ESC [ 1 J: erase from start to cursor.
192 ESC [ 2 J: erase whole display.
193 ESC [ 3 J: erase whole display including scroll-back
194 buffer (since Linux 3.0).
195 .\" ESC [ 3 J: commit f8df13e0a901fe55631fed66562369b4dba40f8b
196 K EL Erase line (default: from cursor to end of line).
197 ESC [ 1 K: erase from start of line to cursor.
198 ESC [ 2 K: erase whole line.
199 L IL Insert the indicated # of blank lines.
200 M DL Delete the indicated # of lines.
201 P DCH Delete the indicated # of characters on current line.
202 X ECH Erase the indicated # of characters on current line.
203 a HPR Move cursor right the indicated # of columns.
204 c DA Answer ESC [ ? 6 c: "I am a VT102".
205 d VPA Move cursor to the indicated row, current column.
206 e VPR Move cursor down the indicated # of rows.
207 f HVP Move cursor to the indicated row, column.
208 g TBC Without parameter: clear tab stop at current position.
209 ESC [ 3 g: delete all tab stops.
210 h SM Set Mode (see below).
211 l RM Reset Mode (see below).
212 m SGR Set attributes (see below).
213 n DSR Status report (see below).
214 q DECLL Set keyboard LEDs.
215 ESC [ 0 q: clear all LEDs
216 ESC [ 1 q: set Scroll Lock LED
217 ESC [ 2 q: set Num Lock LED
218 ESC [ 3 q: set Caps Lock LED
219 r DECSTBM Set scrolling region; parameters are top and bottom row.
220 s ? Save cursor location.
221 u ? Restore cursor location.
222 \` HPA Move cursor to indicated column in current row.
223 .TE
224 .PP
225 .B ECMA-48 Set Graphics Rendition
226 .PP
227 The ECMA-48 SGR sequence ESC [ \fIparameters\fP m sets display
228 attributes.
229 Several attributes can be set in the same sequence, separated by
230 semicolons.
231 An empty parameter (between semicolons or string initiator or
232 terminator) is interpreted as a zero.
233 .TS
234 l l.
235 param result
236 0 reset all attributes to their defaults
237 1 set bold
238 2 set half-bright (simulated with color on a color display)
239 4 T{
240 set underscore (simulated with color on a color display)
241 (the colors used to simulate dim or underline are set
242 using ESC ] ...)
243 T}
244 5 set blink
245 7 set reverse video
246 10 T{
247 reset selected mapping, display control flag,
248 and toggle meta flag (ECMA-48 says "primary font").
249 T}
250 11 T{
251 select null mapping, set display control flag,
252 reset toggle meta flag (ECMA-48 says "first alternate font").
253 T}
254 12 T{
255 select null mapping, set display control flag,
256 set toggle meta flag (ECMA-48 says "second alternate font").
257 The toggle meta flag
258 causes the high bit of a byte to be toggled
259 before the mapping table translation is done.
260 T}
261 21 T{
262 set underline; before Linux 4.17, this value
263 set normal intensity (as is done in many other terminals)
264 T}
265 22 set normal intensity
266 24 underline off
267 25 blink off
268 27 reverse video off
269 30 set black foreground
270 31 set red foreground
271 32 set green foreground
272 33 set brown foreground
273 34 set blue foreground
274 35 set magenta foreground
275 36 set cyan foreground
276 37 set white foreground
277 38 T{
278 256/24-bit foreground color follows, shoehorned into 16 basic colors
279 (before Linux 3.16: set underscore on, set default foreground color)
280 T}
281 39 T{
282 set default foreground color
283 (before Linux 3.16: set underscore off, set default foreground color)
284 T}
285 40 set black background
286 41 set red background
287 42 set green background
288 43 set brown background
289 44 set blue background
290 45 set magenta background
291 46 set cyan background
292 47 set white background
293 48 T{
294 256/24-bit background color follows, shoehorned into 8 basic colors
295 T}
296 49 set default background color
297 90..97 set foreground to bright versions of 30..37
298 100.107 set background, same as 40..47 (bright not supported)
299 .TE
300 .PP
301 Commands 38 and 48 require further arguments:
302 .TS
303 l l.
304 ;5;x T{
305 256 color: values 0..15 are IBGR (black, red, green, ... white),
306 16..231 a 6x6x6 color cube, 232..255 a grayscale ramp
307 T}
308 ;2;r;g;b 24-bit color, r/g/b components are in the range 0..255
309 .TE
310 .PP
311 .B ECMA-48 Mode Switches
312 .TP
313 ESC [ 3 h
314 DECCRM (default off): Display control chars.
315 .TP
316 ESC [ 4 h
317 DECIM (default off): Set insert mode.
318 .TP
319 ESC [ 20 h
320 LF/NL (default off): Automatically follow echo of LF, VT or FF with CR.
321 .\"
322 .PP
323 .B ECMA-48 Status Report Commands
324 .\"
325 .TP
326 ESC [ 5 n
327 Device status report (DSR): Answer is ESC [ 0 n (Terminal OK).
328 .TP
329 ESC [ 6 n
330 Cursor position report (CPR): Answer is ESC [ \fIy\fP ; \fIx\fP R,
331 where \fIx,y\fP is the cursor location.
332 .\"
333 .PP
334 .B DEC Private Mode (DECSET/DECRST) sequences
335 .PP
336 .\"
337 These are not described in ECMA-48.
338 We list the Set Mode sequences;
339 the Reset Mode sequences are obtained by replacing the final \(aqh\(aq
340 by \(aql\(aq.
341 .TP
342 ESC [ ? 1 h
343 DECCKM (default off): When set, the cursor keys send an ESC O prefix,
344 rather than ESC [.
345 .TP
346 ESC [ ? 3 h
347 DECCOLM (default off = 80 columns): 80/132 col mode switch.
348 The driver sources note that this alone does not suffice; some user-mode
349 utility such as
350 .BR resizecons (8)
351 has to change the hardware registers on the console video card.
352 .TP
353 ESC [ ? 5 h
354 DECSCNM (default off): Set reverse-video mode.
355 .TP
356 ESC [ ? 6 h
357 DECOM (default off): When set, cursor addressing is relative to
358 the upper left corner of the scrolling region.
359 .TP
360 ESC [ ? 7 h
361 DECAWM (default on): Set autowrap on.
362 In this mode, a graphic
363 character emitted after column 80 (or column 132 of DECCOLM is on)
364 forces a wrap to the beginning of the following line first.
365 .TP
366 ESC [ ? 8 h
367 DECARM (default on): Set keyboard autorepeat on.
368 .TP
369 ESC [ ? 9 h
370 X10 Mouse Reporting (default off): Set reporting mode to 1 (or reset to
371 0)\(emsee below.
372 .TP
373 ESC [ ? 25 h
374 DECTECM (default on): Make cursor visible.
375 .TP
376 ESC [ ? 1000 h
377 X11 Mouse Reporting (default off): Set reporting mode to 2 (or reset
378 to 0)\(emsee below.
379 .\"
380 .PP
381 .B Linux Console Private CSI Sequences
382 .PP
383 .\"
384 The following sequences are neither ECMA-48 nor native VT102.
385 They are native to the Linux console driver.
386 Colors are in SGR parameters:
387 0 = black, 1 = red, 2 = green, 3 = brown, 4 = blue, 5 = magenta, 6 =
388 cyan, 7 = white; 8\(en15 = bright versions of 0\(en7.
389 .TS
390 l l.
391 ESC [ 1 ; \fIn\fP ] Set color \fIn\fP as the underline color.
392 ESC [ 2 ; \fIn\fP ] Set color \fIn\fP as the dim color.
393 ESC [ 8 ] Make the current color pair the default attributes.
394 ESC [ 9 ; \fIn\fP ] Set screen blank timeout to \fIn\fP minutes.
395 ESC [ 10 ; \fIn\fP ] Set bell frequency in Hz.
396 ESC [ 11 ; \fIn\fP ] Set bell duration in msec.
397 ESC [ 12 ; \fIn\fP ] Bring specified console to the front.
398 ESC [ 13 ] Unblank the screen.
399 ESC [ 14 ; \fIn\fP ] Set the VESA powerdown interval in minutes.
400 ESC [ 15 ] T{
401 Bring the previous console to the front
402 (since Linux 2.6.0).
403 T}
404 ESC [ 16 ; \fIn\fP ] T{
405 Set the cursor blink interval in milliseconds
406 (since Linux 4.2).
407 T}
408 .\" commit bd63364caa8df38bad2b25b11b2a1b849475cce5
409 .TE
410 .SS Character sets
411 The kernel knows about 4 translations of bytes into console-screen
412 symbols.
413 The four tables are: a) Latin1 \-> PC,
414 b) VT100 graphics \-> PC, c) PC \-> PC, d) user-defined.
415 .PP
416 There are two character sets, called G0 and G1, and one of them
417 is the current character set.
418 (Initially G0.)
419 Typing \fB^N\fP causes G1 to become current,
420 \fB^O\fP causes G0 to become current.
421 .PP
422 These variables G0 and G1 point at a translation table, and can be
423 changed by the user.
424 Initially they point at tables a) and b), respectively.
425 The sequences ESC ( B and ESC ( 0 and ESC ( U and ESC ( K cause G0 to
426 point at translation table a), b), c) and d), respectively.
427 The sequences ESC ) B and ESC ) 0 and ESC ) U and ESC ) K cause G1 to
428 point at translation table a), b), c) and d), respectively.
429 .PP
430 The sequence ESC c causes a terminal reset, which is what you want if the
431 screen is all garbled.
432 The oft-advised "echo ^V^O" will make only G0 current,
433 but there is no guarantee that G0 points at table a).
434 In some distributions there is a program
435 .BR reset (1)
436 that just does "echo ^[c".
437 If your terminfo entry for the console is correct
438 (and has an entry rs1=\eEc), then "tput reset" will also work.
439 .PP
440 The user-defined mapping table can be set using
441 .BR mapscrn (8).
442 The result of the mapping is that if a symbol c is printed, the symbol
443 s = map[c] is sent to the video memory.
444 The bitmap that corresponds to
445 s is found in the character ROM, and can be changed using
446 .BR setfont (8).
447 .SS Mouse tracking
448 The mouse tracking facility is intended to return
449 .BR xterm (1)-compatible
450 mouse status reports.
451 Because the console driver has no way to know
452 the device or type of the mouse, these reports are returned in the
453 console input stream only when the virtual terminal driver receives
454 a mouse update ioctl.
455 These ioctls must be generated by a mouse-aware
456 user-mode application such as the
457 .BR gpm (8)
458 daemon.
459 .PP
460 The mouse tracking escape sequences generated by
461 \fBxterm\fP(1) encode numeric parameters in a single character as
462 \fIvalue\fP+040.
463 For example, \(aq!\(aq is 1.
464 The screen coordinate system is 1-based.
465 .PP
466 The X10 compatibility mode sends an escape sequence on button press
467 encoding the location and the mouse button pressed.
468 It is enabled by sending ESC [ ? 9 h and disabled with ESC [ ? 9 l.
469 On button press, \fBxterm\fP(1) sends
470 ESC [ M \fIbxy\fP (6 characters).
471 Here \fIb\fP is button\-1,
472 and \fIx\fP and \fIy\fP are the x and y coordinates of the mouse
473 when the button was pressed.
474 This is the same code the kernel also produces.
475 .PP
476 Normal tracking mode (not implemented in Linux 2.0.24) sends an escape
477 sequence on both button press and release.
478 Modifier information is also sent.
479 It is enabled by sending ESC [ ? 1000 h and disabled with
480 ESC [ ? 1000 l.
481 On button press or release, \fBxterm\fP(1) sends ESC [ M
482 \fIbxy\fP.
483 The low two bits of \fIb\fP encode button information:
484 0=MB1 pressed, 1=MB2 pressed, 2=MB3 pressed, 3=release.
485 The upper bits encode what modifiers were down when the button was
486 pressed and are added together: 4=Shift, 8=Meta, 16=Control.
487 Again \fIx\fP and
488 \fIy\fP are the x and y coordinates of the mouse event.
489 The upper left corner is (1,1).
490 .SS Comparisons with other terminals
491 Many different terminal types are described, like the Linux console,
492 as being "VT100-compatible".
493 Here we discuss differences between the
494 Linux console and the two most important others, the DEC VT102 and
495 .BR xterm (1).
496 .\"
497 .PP
498 .B Control-character handling
499 .PP
500 The VT102 also recognized the following control characters:
501 .HP
502 NUL (0x00) was ignored;
503 .HP
504 ENQ (0x05) triggered an answerback message;
505 .HP
506 DC1 (0x11, \fB^Q\fP, XON) resumed transmission;
507 .HP
508 DC3 (0x13, \fB^S\fP, XOFF) caused VT100 to ignore (and stop transmitting)
509 all codes except XOFF and XON.
510 .PP
511 VT100-like DC1/DC3 processing may be enabled by the terminal driver.
512 .PP
513 The
514 .BR xterm (1)
515 program (in VT100 mode) recognizes the control characters
516 BEL, BS, HT, LF, VT, FF, CR, SO, SI, ESC.
517 .\"
518 .PP
519 .B Escape sequences
520 .PP
521 VT100 console sequences not implemented on the Linux console:
522 .TS
523 l l l.
524 ESC N SS2 Single shift 2. (Select G2 character set for the next
525 character only.)
526 ESC O SS3 Single shift 3. (Select G3 character set for the next
527 character only.)
528 ESC P DCS Device control string (ended by ESC \e)
529 ESC X SOS Start of string.
530 ESC ^ PM Privacy message (ended by ESC \e)
531 ESC \e ST String terminator
532 ESC * ... Designate G2 character set
533 ESC + ... Designate G3 character set
534 .TE
535 .PP
536 The program
537 .BR xterm (1)
538 (in VT100 mode) recognizes ESC c, ESC # 8, ESC >, ESC =,
539 ESC D, ESC E, ESC H, ESC M, ESC N, ESC O, ESC P ... ESC \e,
540 ESC Z (it answers ESC [ ? 1 ; 2 c, "I am a VT100 with
541 advanced video option")
542 and ESC ^ ... ESC \e with the same meanings as indicated above.
543 It accepts ESC (, ESC ), ESC *, ESC + followed by 0, A, B for
544 the DEC special character and line drawing set, UK, and US-ASCII,
545 respectively.
546 .PP
547 The user can configure \fBxterm\fP(1) to respond to VT220-specific
548 control sequences, and it will identify itself as a VT52, VT100, and
549 up depending on the way it is configured and initialized.
550 .PP
551 It accepts ESC ] (OSC) for the setting of certain resources.
552 In addition to the ECMA-48 string terminator (ST),
553 \fBxterm\fP(1) accepts a BEL to terminate an OSC string.
554 These are a few of the OSC control sequences recognized by \fBxterm\fP(1):
555 .TS
556 l l.
557 ESC ] 0 ; \fItxt\fP ST Set icon name and window title to \fItxt\fP.
558 ESC ] 1 ; \fItxt\fP ST Set icon name to \fItxt\fP.
559 ESC ] 2 ; \fItxt\fP ST Set window title to \fItxt\fP.
560 ESC ] 4 ; \fInum\fP; \fItxt\fP ST Set ANSI color \fInum\fP to \fItxt\fP.
561 ESC ] 10 ; \fItxt\fP ST Set dynamic text color to \fItxt\fP.
562 ESC ] 4 6 ; \fIname\fP ST Change log file to \fIname\fP (normally disabled
563 by a compile-time option)
564 ESC ] 5 0 ; \fIfn\fP ST Set font to \fIfn\fP.
565 .TE
566 .PP
567 It recognizes the following with slightly modified meaning
568 (saving more state, behaving closer to VT100/VT220):
569 .TS
570 l l l.
571 ESC 7 DECSC Save cursor
572 ESC 8 DECRC Restore cursor
573 .TE
574 .PP
575 It also recognizes
576 .TS
577 l l l.
578 ESC F Cursor to lower left corner of screen (if enabled by
579 \fBxterm\fP(1)'s \fBhpLowerleftBugCompat\fP resource)
580 ESC l Memory lock (per HP terminals).
581 Locks memory above the cursor.
582 ESC m Memory unlock (per HP terminals).
583 ESC n LS2 Invoke the G2 character set.
584 ESC o LS3 Invoke the G3 character set.
585 ESC | LS3R Invoke the G3 character set as GR.
586 ESC } LS2R Invoke the G2 character set as GR.
587 ESC ~ LS1R Invoke the G1 character set as GR.
588 .TE
589 .PP
590 It also recognizes ESC % and provides a more complete UTF-8
591 implementation than Linux console.
592 .\"
593 .PP
594 .B CSI Sequences
595 .PP
596 Old versions of \fBxterm\fP(1), for example, from X11R5,
597 interpret the blink SGR as a bold SGR.
598 Later versions which implemented ANSI colors, for example,
599 XFree86 3.1.2A in 1995, improved this by allowing
600 the blink attribute to be displayed as a color.
601 Modern versions of xterm implement blink SGR as blinking text
602 and still allow colored text as an alternate rendering of SGRs.
603 Stock X11R6 versions did not recognize the color-setting SGRs until
604 the X11R6.8 release, which incorporated XFree86 xterm.
605 All ECMA-48 CSI sequences recognized by Linux are also recognized by
606 .IR xterm ,
607 however \fBxterm\fP(1) implements several ECMA-48 and DEC control sequences
608 not recognized by Linux.
609 .PP
610 The \fBxterm\fP(1)
611 program recognizes all of the DEC Private Mode sequences listed
612 above, but none of the Linux private-mode sequences.
613 For discussion of \fBxterm\fP(1)'s
614 own private-mode sequences, refer to the
615 \fIXterm Control Sequences\fP
616 document by
617 Edward Moy,
618 Stephen Gildea,
619 and Thomas E.\& Dickey
620 available with the X distribution.
621 That document, though terse, is much longer than this manual page.
622 For a chronological overview,
623 .PP
624 .RS
625 .UR http://invisible\-island.net\:/xterm\:/xterm.log.html
626 .UE
627 .RE
628 .PP
629 details changes to xterm.
630 .PP
631 The \fIvttest\fP program
632 .PP
633 .RS
634 .UR http://invisible\-island.net\:/vttest/
635 .UE
636 .RE
637 .PP
638 demonstrates many of these control sequences.
639 The \fBxterm\fP(1) source distribution also contains sample
640 scripts which exercise other features.
641 .SH NOTES
642 ESC 8 (DECRC) is not able to restore the character set changed with
643 ESC %.
644 .SH BUGS
645 In 2.0.23, CSI is broken, and NUL is not ignored inside
646 escape sequences.
647 .PP
648 Some older kernel versions (after 2.0) interpret 8-bit control
649 sequences.
650 These "C1 controls" use codes between 128 and 159 to replace
651 ESC [, ESC ] and similar two-byte control sequence initiators.
652 There are fragments of that in modern kernels (either overlooked or
653 broken by changes to support UTF-8),
654 but the implementation is incomplete and should be regarded
655 as unreliable.
656 .PP
657 Linux "private mode" sequences do not follow the rules in ECMA-48
658 for private mode control sequences.
659 In particular, those ending with ] do not use a standard terminating
660 character.
661 The OSC (set palette) sequence is a greater problem,
662 since \fBxterm\fP(1) may interpret this as a control sequence
663 which requires a string terminator (ST).
664 Unlike the \fBsetterm\fP(1) sequences which will be ignored (since
665 they are invalid control sequences), the palette sequence will make
666 \fBxterm\fP(1) appear to hang (though pressing the return-key
667 will fix that).
668 To accommodate applications which have been hardcoded to use Linux
669 control sequences,
670 set the \fBxterm\fP(1) resource \fBbrokenLinuxOSC\fP to true.
671 .PP
672 An older version of this document implied that Linux recognizes the
673 ECMA-48 control sequence for invisible text.
674 It is ignored.
675 .SH SEE ALSO
676 .BR ioctl_console (2),
677 .BR charsets (7)