Next Previous Contents

21. Appendix B: Escape Sequence Commands Terminology

These are sometimes called "control sequences". This section of Text-Terminal-HOWTO is incomplete (and may never be complete as there are such a huge number of control sequences). This section is for reference and perhaps really belongs in something that would be called "Text-Terminal-Programming-HOWTO".

An example of an ANSI standard escape sequence is ESC[5B which moves the cursor down 5 lines. ESC is the Escape character. The parameter 5 is included in the sequence. If it were 7 the cursor would move down 7 lines, etc. A listing for this sequence as "move cursor down x lines: ESC[xB" is easy to to understand. But command jargon such as: "tertiary device attribute request" is less comprehensible. This section will try to explain some of the more arcane jargon used for escape sequence commands. A full listing (including the escape sequence codes for the ANSI standard) is a "wish list" project. Since many escape sequences do the same thing as is done when setting up the terminal with Set-Up Options, such escape sequences options will not be repeated here.

21.1 Esc Sequence List

For a list of many (but not all) escape sequences for various terminals see Teemworld Escape Sequences. These are used for terminal emulation and are not always the same as on the corresponding real terminal. A list for VT (not maintained) may be found at Emulators FAQ. Search for "VT". For downloading manuals see VT Manuals.

21.2 8-bit Control Codes

Table of 8-bit DEC control codes (in hexadecimal). Work on VT2xx or later. CSI is the most common.

ACRONYM  FULL_NAME                      HEX     REPLACES
IND Index (down one line)               84      ESC D
NEL Next Line                           85      ESC E
RI  Reverse Index (one line up)         8D      ESC M
SS2 Single Shift 2                      8E      ESC N
SS3 Single Shift 3                      8F      ESC O
DCS Device Control String               90      ESC P
CSI Control Sequence Introducer)        9B      ESC [
ST  String Terminator                   9C      ESC \

21.3 Printer Esc

21.4 Reports

These sequences are usually a request sent from the host to request a report from the terminal. The terminal responds by sending a report (actually another escape sequence) to the host which has embedded in it certain values telling the host about the current state of the terminal. In some cases a report may be sent to the host even if it wasn't asked for. This sometimes happens when set-up is exited. By default no unsolicited reports should be sent.

21.5 Cursor Movements

The cursor is where the next character received from the host will be displayed. Most of the cursor movements are self-explanatory. "index cursor" means to move the cursor down one line. Cursor movements may be relative to the current position such as "move 4 spaces left" or absolute such as "move to row 3, column 39". Absolute is called "Direct Cursor Positioning" or "Direct Cursor Addressing".

The home position is row 1 col. 1 (index origin is 1). But where this home position is on the physical screen is not completely clear. If "Cursor Origin Mode" = "Relative Origin Mode" is set, then home is at the top of the scrolling region (not necessarily the top of the screen) at the left edge of the screen. If "Absolute Origin Mode" is set (the same as unsetting any of the two modes in the previous sentence) then home is at the upper left corner of the screen. On some old terminals if "Cursor Origin Mode" is set it means that it's relative.

21.6 Pages (definition)

See Pages for an explanation of pages. There are a number of escape sequences to deal with pages. Text may be copied from one page to another and one may move the cursor from page to page. Switching pages may or may not be automatic: when the screen becomes full (page 1) then more data from the host goes to page 2. The cursor may only be on one page at a time and characters which are sent to the terminal go there. If that page is not being displayed, new text will be received by the terminal and go into display memory, but you will not see it (until the terminal is switched to that page).


Next Previous Contents