ANSI and VT100 Terminal Control Escape Sequences

From Free Knowledge Base- The DUCK Project: information for everyone
Revision as of 16:54, 22 August 2012 by Admin (Talk | contribs)

Jump to: navigation, search

The terminal control sequences that follow the ESC character are dependent on which terminal the control codes were generated for. Many terminal emulators support color and cursor control through a system of escape sequences. One such standard is commonly referred to as ANSI Color. Several terminal specifications are based on the ANSI color standard, including VT100.

<ESC> represents the ASCII "escape" character, 0x1B. Bracketed tags represent modifiable decimal parameters; eg. {ROW} would be replaced by a row number.

Device Status The following codes are used for reporting terminal/display settings, and vary depending on the implementation:

Query Device Code <ESC>[c

  • Requests a Report Device Code response from the device.

Report Device Code <ESC>[{code}0c

  • Generated by the device in response to Query Device Code request.

Query Device Status <ESC>[5n

  • Requests a Report Device Status response from the device.

Report Device OK <ESC>[0n

  • Generated by the device in response to a Query Device Status request; indicates that device is functioning correctly.

Report Device Failure <ESC>[3n

  • Generated by the device in response to a Query Device Status request; indicates that device is functioning improperly.

Query Cursor Position <ESC>[6n

  • Requests a Report Cursor Position response from the device.

Report Cursor Position <ESC>[{ROW};{COLUMN}R

  • Generated by the device in response to a Query Cursor Position request; reports current cursor position.