Control sequence A control sequence is a sequence of characters that changes the
state of a computer
peripheral instead of conveying the normal information that the characters represent. In an ANSI escape sequence, the escape sequence prefix, called
control sequence introducer, can be either ASCII ESC (decimal 27) followed by [ or CSI (decimal 155). Notable systems that did not use an escape character for control sequences include: • The
Hayes command set defines a
modal control sequence,
+++, which switches from command to online mode. To ensure that the sequence is interpreted as a control sequence instead of embedded in content, the sender stops communication for one second before and after sending . When the modem detects condition, it switches from normal mode (sending characters to the phone) to a command mode in which the data is interpreted a command. Sending the O command switches back to the normal mode. •
Data General terminal control sequences, but they often were still called escape sequences, and the very common use of "escaping" special characters in programming languages and command-line parameters today often use the "backslash" character to begin the sequence. Escape sequences in communications are commonly used when a computer and a peripheral have only a single channel through which to send information back and forth (so escape sequences are an example of
in-band signaling). They were common when most
dumb terminals used
ASCII with 7 data bits for communication, and sometimes would be used to switch to a different character set for "foreign" or graphics characters that would otherwise been restricted by the 128 codes available in 7 data bits. Even relatively "dumb" terminals responded to some escape sequences, including the original mechanical Teletype printers (on which "glass Teletypes" or VDUs were based) responded to characters 27 and 31 to alternate between letters and figures modes.
Esc key Many
computer keyboards have an
Esc key (where
Esc is short for
escape) even though it is generally not used for entering an escape sequence. The
vi text editor uses the key to exit from input mode. Some application use the key to cancel an operation or navigate up a level of a nested context. ==See also==