ASCII: Difference between revisions

Content deleted Content added
Hym3242 (talk | contribs)
Hym3242 (talk | contribs)
Line 276:
Many more of the control characters have been assigned meanings quite different from their original ones. The "escape" character (ESC, code 27), for example, was intended originally to allow sending of other control characters as literals instead of invoking their meaning, an "escape sequence". This is the same meaning of "escape" encountered in URL encodings, [[C (programming language)|C language]] strings, and other systems where certain characters have a reserved meaning. Over time this interpretation has been co-opted and has eventually been changed.
 
In modern usage, an ESC sent ''to'' the terminal usually indicates the start of a command sequence, which can be used to address the cursor, scroll a region, set/query various terminal properties, and more. They are usually in the form of a so-called "[[ANSI escape code]]" (or, more properly, an escape sequence with a "[[Control Sequence Introducer]]", CSI) from ECMA-48 (1972) and its successors if followed immediately by a "<nowiki>[</nowiki>" (left-bracket) character. Other escape sequence headers exist and are still used today, like OSC("Operating System Command", ESC followed by a '<nowiki>]</nowiki>'). Some escape sequences do not have initiators, like the VT100 full reset command "ESC c". <ref>{{cite web|url=https://invisible-island.net/xterm/ctlseqs/ctlseqs.html|title=XTerm Control Sequences|access-date=January 17, 2024}}</ref>
 
In contrast, an ESC read ''from'' the terminal is most often used as an [[out-of-band data|out-of-band]] character used to terminate an operation or special mode, as in the [[Text Editor and Corrector|TECO]] and [[Vi (text editor)|vi]] [[text editor]]s. In [[graphical user interface]] (GUI) and [[window (computing)|windowing]] systems, ESC generally causes an application to abort its current operation or to [[exit (system call)|exit]] (terminate) altogether.