diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:41:07 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-15 19:41:07 +0000 |
commit | 3af6d22bb3850ab2bac67287e3a3d3b0e32868e5 (patch) | |
tree | 3ee7a3ec64525911fa865bb984c86d997d855527 /man4/console_codes.4 | |
parent | Adding debian version 6.05.01-1. (diff) | |
download | manpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.tar.xz manpages-3af6d22bb3850ab2bac67287e3a3d3b0e32868e5.zip |
Merging upstream version 6.7.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'man4/console_codes.4')
-rw-r--r-- | man4/console_codes.4 | 117 |
1 files changed, 59 insertions, 58 deletions
diff --git a/man4/console_codes.4 b/man4/console_codes.4 index e2ac4e8..afc8c70 100644 --- a/man4/console_codes.4 +++ b/man4/console_codes.4 @@ -6,7 +6,7 @@ .\" This is combined from many sources. .\" For Linux, the definitive source is of course console.c. .\" About vt100-like escape sequences in general there are -.\" the ISO 6429 and ISO 2022 norms, the descriptions of +.\" the ISO/IEC 6429 and ISO/IEC 2022 norms, the descriptions of .\" an actual vt100, and the xterm docs (ctlseqs.ms). .\" Substantial portions of this text are derived from a write-up .\" by Eric S. Raymond <esr@thyrsus.com>. @@ -15,41 +15,42 @@ .\" .\" 2006-05-27, Several corrections - Thomas E. Dickey .\" -.TH console_codes 4 2023-02-05 "Linux man-pages 6.05.01" +.TH console_codes 4 2024-01-28 "Linux man-pages 6.7" .SH NAME console_codes \- Linux console escape and control sequences .SH DESCRIPTION -The Linux console implements a large subset of the VT102 and ECMA-48/ISO -6429/ANSI X3.64 terminal controls, plus certain private-mode sequences +The Linux console implements a large subset of +the VT102 and ECMA-48 / ISO/IEC\~6429 / ANSI X3.64 terminal controls, +plus certain private-mode sequences for changing the color palette, character-set mapping, and so on. In the tabular descriptions below, the second column gives ECMA-48 or DEC mnemonics (the latter if prefixed with DEC) for the given function. Sequences without a mnemonic are neither ECMA-48 nor VT102. -.PP +.P After all the normal output processing has been done, and a stream of characters arrives at the console driver for actual printing, the first thing that happens is a translation from the code used for processing to the code used for printing. -.PP +.P If the console is in UTF-8 mode, then the incoming bytes are first assembled into 16-bit Unicode codes. Otherwise, each byte is transformed according to the current mapping table (which translates it to a Unicode value). See the \fBCharacter Sets\fP section below for discussion. -.PP +.P In the normal case, the Unicode value is converted to a font index, and this is stored in video memory, so that the corresponding glyph (as found in video ROM) appears on the screen. Note that the use of Unicode (and the design of the PC hardware) allows us to use 512 different glyphs simultaneously. -.PP +.P If the current Unicode value is a control character, or we are currently processing an escape sequence, the value will treated specially. Instead of being turned into a font index and rendered as a glyph, it may trigger cursor movement or other control functions. See the \fBLinux Console Controls\fP section below for discussion. -.PP +.P It is generally not good practice to hard-wire terminal controls into programs. Linux supports a @@ -65,9 +66,9 @@ or This section describes all the control characters and escape sequences that invoke special functions (i.e., anything other than writing a glyph at the current cursor location) on the Linux console. -.PP +.P .B "Control characters" -.PP +.P A character is a control character if (before transformation according to the mapping table) it has one of the 14 codes 00 (NUL), 07 (BEL), 08 (BS), 09 (HT), 0a (LF), 0b (VT), @@ -78,7 +79,7 @@ and allow 07, 09, 0b, 18, 1a, 7f to be displayed as glyphs. On the other hand, in UTF-8 mode all codes 00\[en]1f are regarded as control characters, regardless of any "display control characters" mode. -.PP +.P If we have a control character, it is acted upon immediately and then discarded (even in the middle of an escape sequence) and the escape sequence continues with the next character. @@ -129,7 +130,7 @@ is ignored; .TP CSI (0x9B) is equivalent to ESC [. -.PP +.P .B "ESC- but not CSI-sequences" .ad l .TS @@ -152,7 +153,7 @@ ESC 8 DECRC T{ Restore state most recently saved by ESC 7. T} ESC % Start sequence selecting character set -ESC % @ \0\0\0Select default (ISO 646 / ISO 8859-1) +ESC % @ \0\0\0Select default (ISO/IEC\~646 / ISO/IEC\~8859-1) ESC % G \0\0\0Select UTF-8 ESC % 8 \0\0\0Select UTF-8 (obsolete) ESC # 8 DECALN T{ @@ -163,7 +164,7 @@ Start sequence defining G0 character set (followed by one of B, 0, U, K, as below) T} ESC ( B T{ -Select default (ISO 8859-1 mapping). +Select default (ISO/IEC\~8859-1 mapping). T} ESC ( 0 T{ Select VT100 graphics mapping. @@ -190,19 +191,19 @@ the red/green/blue values (0\[en]255). T} .TE .ad -.PP +.P .B "ECMA-48 CSI sequences" -.PP +.P CSI (or ESC [) is followed by a sequence of parameters, at most NPAR (16), that are decimal numbers separated by semicolons. An empty or absent parameter is taken to be 0. The sequence of parameters may be preceded by a single question mark. -.PP +.P However, after CSI [ (or ESC [ [) a single character is read and this entire sequence is ignored. (The idea is to ignore an echoed function key.) -.PP +.P The action of a CSI sequence is determined by its final character. .ad l .TS @@ -309,9 +310,9 @@ Move cursor to indicated column in current row. T} .TE .ad -.PP +.P .B ECMA-48 Select Graphic Rendition -.PP +.P The ECMA-48 SGR sequence ESC [ \fIparameters\fP m sets display attributes. Several attributes can be set in the same sequence, separated by @@ -397,7 +398,7 @@ set background, same as 40..47 (bright not supported) T} .TE .ad -.PP +.P Commands 38 and 48 require further arguments: .TS l lx. @@ -409,7 +410,7 @@ T} 24-bit color, r/g/b components are in the range 0..255 T} .TE -.PP +.P .B ECMA-48 Mode Switches .TP ESC [ 3 h @@ -421,7 +422,7 @@ DECIM (default off): Set insert mode. ESC [ 20 h LF/NL (default off): Automatically follow echo of LF, VT, or FF with CR. .\" -.PP +.P .B ECMA-48 Status Report Commands .\" .TP @@ -432,9 +433,9 @@ ESC [ 6 n Cursor position report (CPR): Answer is ESC [ \fIy\fP ; \fIx\fP R, where \fIx,y\fP is the cursor location. .\" -.PP +.P .B DEC Private Mode (DECSET/DECRST) sequences -.PP +.P .\" These are not described in ECMA-48. We list the Set Mode sequences; @@ -479,9 +480,9 @@ ESC [ ? 1000 h X11 Mouse Reporting (default off): Set reporting mode to 2 (or reset to 0)\[em]see below. .\" -.PP +.P .B Linux Console Private CSI Sequences -.PP +.P .\" The following sequences are neither ECMA-48 nor native VT102. They are native to the Linux console driver. @@ -532,13 +533,13 @@ The kernel knows about 4 translations of bytes into console-screen symbols. The four tables are: a) Latin1 \-> PC, b) VT100 graphics \-> PC, c) PC \-> PC, d) user-defined. -.PP +.P There are two character sets, called G0 and G1, and one of them is the current character set. (Initially G0.) Typing \fB\[ha]N\fP causes G1 to become current, \fB\[ha]O\fP causes G0 to become current. -.PP +.P These variables G0 and G1 point at a translation table, and can be changed by the user. Initially they point at tables a) and b), respectively. @@ -546,7 +547,7 @@ The sequences ESC ( B and ESC ( 0 and ESC ( U and ESC ( K cause G0 to point at translation table a), b), c), and d), respectively. The sequences ESC ) B and ESC ) 0 and ESC ) U and ESC ) K cause G1 to point at translation table a), b), c), and d), respectively. -.PP +.P The sequence ESC c causes a terminal reset, which is what you want if the screen is all garbled. The oft-advised "echo \[ha]V\[ha]O" will make only G0 current, @@ -556,7 +557,7 @@ In some distributions there is a program that just does "echo \[ha][c". If your terminfo entry for the console is correct (and has an entry rs1=\eEc), then "tput reset" will also work. -.PP +.P The user-defined mapping table can be set using .BR mapscrn (8). The result of the mapping is that if a symbol c is printed, the symbol @@ -576,13 +577,13 @@ These ioctls must be generated by a mouse-aware user-mode application such as the .BR gpm (8) daemon. -.PP +.P The mouse tracking escape sequences generated by \fBxterm\fP(1) encode numeric parameters in a single character as \fIvalue\fP+040. For example, \[aq]!\[aq] is 1. The screen coordinate system is 1-based. -.PP +.P The X10 compatibility mode sends an escape sequence on button press encoding the location and the mouse button pressed. It is enabled by sending ESC [ ? 9 h and disabled with ESC [ ? 9 l. @@ -592,7 +593,7 @@ Here \fIb\fP is button\-1, and \fIx\fP and \fIy\fP are the x and y coordinates of the mouse when the button was pressed. This is the same code the kernel also produces. -.PP +.P Normal tracking mode (not implemented in Linux 2.0.24) sends an escape sequence on both button press and release. Modifier information is also sent. @@ -614,9 +615,9 @@ Here we discuss differences between the Linux console and the two most important others, the DEC VT102 and .BR xterm (1). .\" -.PP +.P .B Control-character handling -.PP +.P The VT102 also recognized the following control characters: .TP NUL (0x00) @@ -631,17 +632,17 @@ resumed transmission; DC3 (0x13, \fB\[ha]S\fP, XOFF) caused VT100 to ignore (and stop transmitting) all codes except XOFF and XON. -.PP +.P VT100-like DC1/DC3 processing may be enabled by the terminal driver. -.PP +.P The .BR xterm (1) program (in VT100 mode) recognizes the control characters BEL, BS, HT, LF, VT, FF, CR, SO, SI, ESC. .\" -.PP +.P .B Escape sequences -.PP +.P VT100 console sequences not implemented on the Linux console: .TS l l l. @@ -660,7 +661,7 @@ ESC \e ST String terminator ESC * ... Designate G2 character set ESC + ... Designate G3 character set .TE -.PP +.P The program .BR xterm (1) (in VT100 mode) recognizes ESC c, ESC # 8, ESC >, ESC =, @@ -671,11 +672,11 @@ and ESC \[ha] ... ESC \e with the same meanings as indicated above. It accepts ESC (, ESC ), ESC *, ESC + followed by 0, A, B for the DEC special character and line drawing set, UK, and US-ASCII, respectively. -.PP +.P The user can configure \fBxterm\fP(1) to respond to VT220-specific control sequences, and it will identify itself as a VT52, VT100, and up depending on the way it is configured and initialized. -.PP +.P It accepts ESC ] (OSC) for the setting of certain resources. In addition to the ECMA-48 string terminator (ST), \fBxterm\fP(1) accepts a BEL to terminate an OSC string. @@ -694,7 +695,7 @@ Change log file to \fIname\fP (normally disabled by a compile-time option). T} ESC ] 5 0 ; \fIfn\fP ST Set font to \fIfn\fP. .TE -.PP +.P It recognizes the following with slightly modified meaning (saving more state, behaving closer to VT100/VT220): .TS @@ -702,7 +703,7 @@ l l l. ESC 7 DECSC Save cursor ESC 8 DECRC Restore cursor .TE -.PP +.P It also recognizes .TS l l lx. @@ -719,13 +720,13 @@ ESC | LS3R Invoke the G3 character set as GR. ESC } LS2R Invoke the G2 character set as GR. ESC \[ti] LS1R Invoke the G1 character set as GR. .TE -.PP +.P It also recognizes ESC % and provides a more complete UTF-8 implementation than Linux console. .\" -.PP +.P .B CSI Sequences -.PP +.P Old versions of \fBxterm\fP(1), for example, from X11R5, interpret the blink SGR as a bold SGR. Later versions which implemented ANSI colors, for example, @@ -739,7 +740,7 @@ All ECMA-48 CSI sequences recognized by Linux are also recognized by .IR xterm , however \fBxterm\fP(1) implements several ECMA-48 and DEC control sequences not recognized by Linux. -.PP +.P The \fBxterm\fP(1) program recognizes all of the DEC Private Mode sequences listed above, but none of the Linux private-mode sequences. @@ -753,21 +754,21 @@ and Thomas E.\& Dickey available with the X distribution. That document, though terse, is much longer than this manual page. For a chronological overview, -.PP +.P .RS .UR http://invisible\-island.net\:/xterm\:/xterm.log.html .UE .RE -.PP +.P details changes to xterm. -.PP +.P The \fIvttest\fP program -.PP +.P .RS .UR http://invisible\-island.net\:/vttest/ .UE .RE -.PP +.P demonstrates many of these control sequences. The \fBxterm\fP(1) source distribution also contains sample scripts which exercise other features. @@ -777,7 +778,7 @@ ESC %. .SH BUGS In Linux 2.0.23, CSI is broken, and NUL is not ignored inside escape sequences. -.PP +.P Some older kernel versions (after Linux 2.0) interpret 8-bit control sequences. These "C1 controls" use codes between 128 and 159 to replace @@ -786,7 +787,7 @@ There are fragments of that in modern kernels (either overlooked or broken by changes to support UTF-8), but the implementation is incomplete and should be regarded as unreliable. -.PP +.P Linux "private mode" sequences do not follow the rules in ECMA-48 for private mode control sequences. In particular, those ending with ] do not use a standard terminating @@ -801,7 +802,7 @@ will fix that). To accommodate applications which have been hardcoded to use Linux control sequences, set the \fBxterm\fP(1) resource \fBbrokenLinuxOSC\fP to true. -.PP +.P An older version of this document implied that Linux recognizes the ECMA-48 control sequence for invisible text. It is ignored. |