-->

Previous | Table of Contents | Next

Page 1070

Character Function Description
g TBC Without parameter: clear tab stop at the current position.
ESC [ 3 g: delete all tab stops.
h SM Set mode.
l RM Reset mode.
m SGR Set attributes.
n DSR Status report.
q DECLL Set keyboard LEDs.
ESC [ 0 q: clear all LEDs
ESC [ 1 q: set Scroll Lock LED
ESC [ 2 q: set Num Lock LED
ESC [ 3 q: set Caps Lock LED
r DECSTBM Set scrolling region; parameters are top and bottom row.
s ? Save cursor location.
u ? Restore cursor location.
` HPA Move cursor to indicated column in current row.

ECMA-48 SET GRAPHICS RENDITION

The ECMA-48 SGR sequence ESC [ <parameters> m sets display attributes. Several attributes can be set in the same sequence.

Parameter Result
0 Reset all attributes to their defaults.
1 Set bold.
2 Set half-bright (simulated with color on a color display).
4 Set underscore (simulated with color on a color display).
(The colors used to simulate dim or underline are set using ESC ] ....)
5 Set blink.
7 Set reverse video.
10 Reset selected mapping, display control flag, and toggle meta flag.
11 Select null mapping, set display control flag, reset toggle meta flag.
12 Select null mapping, set display control flag, set toggle meta flag. (The toggle meta flag causes the high bit of a byte to be toggled before the mapping table translation is done.)
21 Set normal intensity. (This is not compatible with ECMA-48.)
22 Set normal intensity.
24 Underline off.
25 Blink off.
27 Reverse video off.
30 Set black foreground.
31 Set red foreground.
32 Set green foreground.
33 Set brown foreground.
34 Set blue foreground.
35 Set magenta foreground.

Page 1071

Parameter Result
36 Set cyan foreground.
37 Set white foreground.
38 Set underscore on, set default foreground color.
39 Set underscore off, set default foreground color.
40 Set black background.
41 Set red background.
42 Set green background.
43 Set brown background.
44 Set blue background.
45 Set magenta background.
46 Set cyan background.
47 Set white background.
49 Set default background color.

ECMA-48 MODE SWITCHES

ESC [ 3 h DECCRM (default off): Display control chars.
ESC [ 4 h DECIM (default off): Set insert mode.
ESC [ 20 h LF/NL (default off): Automatically follow echo of LF, VT, or FF with CR.

ECMA-48 STATUS REPORT COMMANDS

ESC [ 5 n Device status report (DSR): Answer is ESC [ 0 n (Terminal OK).
ESC [ 6 n Cursor position report (CPR): Answer is ESC [ y ; x R, where x, y is the cursor location.

DEC PRIVATE MODE(DECSET/DECRST) SEQUENCES

These are not described in ECMA-48. The Set Mode sequences are listed; the Reset Mode sequences are obtained by replacing the final h by l.

ESC [ ? 1 h DECCKM (default off): When set, the cursor keys send an ESC O prefix, rather than ESC [.
ESC [ ? 3 h DECCOLM (default off = 80 columns): 80/132 col mode switch. The driver sources note that this alone does not suffice; some user-mode utility such as resizecons(8) has to change the hardware registers on the console video card.
ESC [ ? 5 h DECSCNM (default off): Set reverse-video mode.
ESC [ ? 6 h DECOM (default off): When set, cursor addressing is relative to the upper left corner of the scrolling region.
ESC [ ? 7 h DECAWM(default on): Set autowrap on. In this mode, a graphics character emitted after column 80 (or column 132 of DECCOLM is on) forces a wrap to the beginning of the following line first.
ESC [ ? 8 h DECARM (default on): Set keyboard autorepreat on.
ESC [ ? 9 h X10 Mouse Reporting (default off): Set reporting mode to 1 (or reset to 0).
(See "Mouse Tracking.")
ESC [ ? 25 h DECCM (default on): Make cursor visible.
ESC [ ? 1000 h X11 Mouse Reporting (default off): Set reporting mode to 2 (or reset to 0).
(See "Mouse Tracking.")

Page 1072

LINUX CONSOLE PRIVATE CSI SEQUENCES

The following sequences are neither ECMA-48 nor native VT102. They are native to the Linux console driver. Colors are in SGR parameters: 0 = black, 1 = red, 2 = green, 3 = brown, 4 = blue, 5 = magenta, 6 = cyan, 7 = white.

ESC [ 1 ; n ] Set color n as the underline color
ESC [ 2 ; n ] Set color n as the dim color
ESC [ 8 ] Make the current color pair the default attributes
ESC [ 9 ; n ] Set screen blank time-out to n minutes
ESC [ 10 ; n ] Set bell frequency in Hz
ESC [ 11 ; n ] Set bell duration in msec
ESC [ 12 ; n ] Bring specified console to the front
ESC [ 13 ] Unblank the screen
ESC [ 14 ] Set the VESA powerdown interval

CHARACTER SETS

The kernel knows about four translations of bytes into console-screen symbols. The four tables are

There are two character sets, called G0 and G1, and one of them is the current character set. (Initially G0.) Typing ^N causes G1 to become current, ^O causes G0 to become current.

These variables G0 and G1 point to a translation table, and can be changed by the user. Initially, they point at the first two tables, Latin1 to PC and VT100 graphics to PC, respectively. The sequences ESC ( B and ESC ( 0 and ESC ( U and ESC ( K cause G0 to point at the first, second, third, and fourth translation tables in the preceding list, respectively. The sequences ESC ) B and ESC ) 0 and ESC ) U and ESC ) K cause G1 to point at the first, second, third, and fourth translation tables in the preceding list, respectively.

The sequence ESC c causes a terminal reset, which is what you want if the screen is all garbled. The oft-advised "echo ^V^O" will only make G0 current, but there is no guarantee that G0 points at the first table. In some distributions there is a program reset(1) that just does echo ^[c. If your terminfo entry for the console is correct (and has an entry rs1=c), then tput reset will also work.

The user-defined mapping table can be set using mapscrn(8). The result of the mapping is that if a symbol c is printed, the symbol s = map[c] is sent to the video memory. The bitmap that corresponds to s is found in the character ROM, and can be changed using setfont(8).

MOUSE TRACKING

The mouse tracking facility is intended to return xterm-compatible mouse status reports. Because the console driver has no way to know the device or type of the mouse, these reports are returned in the console input stream only when the virtual terminal driver receives a mouse update ioctl. These ioctls must be generated by a mouse-aware user-mode application such as the gpm(8) daemon.

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 coordinate system is 1-based.

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. On button press, xterm sends ESC [ M bxy (six characters). Here b is button 1, and x and y are the x and y coordinates of the mouse when the button was pressed. This is the same code the kernel also produces.

Previous | Table of Contents | Next