# Sources

> The documents each sequence page cites, and how the citations link to them.

Every sequence page lists where the sequence is defined. Each citation names
the section and the printed page, and links straight to that page of a scan.
Some sequences are missing from some of these documents, and that is
informative too: CBT and CHT are not in DEC STD 070, and nothing here
defines the window title except xterm.

## ECMA-48

*Control Functions for Coded Character Sets*, 5th edition, June 1991. This
is the standard that defines the control functions themselves and their
encoding: what `CSI Pn D` means, independent of any terminal. Ecma
contributed this edition to ISO/IEC to become the third edition of
ISO/IEC 6429. Its names sometimes differ from the ones terminals use: CUB is
*Cursor Left*, ED is *Erase in Page*, HT is *Character Tabulation* and RI is
*Reverse Line Feed*.

Read it [at the Internet Archive](https://archive.org/details/ecma-48-5th-edition-june-1991).
Ecma also publishes it [on its own site](https://ecma-international.org/publications-and-standards/standards/ecma-48/).

## DEC STD 070

*Video Systems Reference Manual*, Rev H, December 1991. This is Digital's
internal standard for its VT terminals. For each control function it gives
the format and the default, the state the function touches, notes on the edge
cases, and an algorithm in pseudo-code. It is the most precise of the three
on behavior at the margins. Every citation here is to section 5,
*Character Cell Display*, whose pages are numbered `5-1` onwards, except
DECALN, which appears only in Appendix D, *Documented Exceptions*.

Read it [at the Internet Archive](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381).
It was marked *Digital Internal Use Only*. This scan is bitsavers'.

## VT510 Video Terminal Programmer Information

Digital's programmer manual for the VT510, first edition, November 1993. This
is what a programmer outside Digital was told. It describes the terminal as
it was built rather than as the standard required, and gives the control
characters in one table rather than one by one. VT100.net
[reproduces it online](https://vt100.net/docs/vt510-rm/), and the sequence
pages link there.

## xterm

Where the documents above say nothing, a page may cite what xterm does.
Those citations link to its source,
[xterm-snapshots](https://github.com/ThomasDickey/xterm-snapshots) at the tag
`xterm-411a`, and to its own
[Control Sequences](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)
document. esctest2, the test suite for xterm's behavior, is cited by test name.

## When the sources disagree

They often do, and so do they with what terminals actually do. Where DEC STD
070 and xterm disagree, the cases follow xterm, bugs included, and the page
says what DEC STD 070 asks for instead. That is Ghostty's own policy: the
first of the principles it states for its terminal features is xterm
compatibility, because "xterm is the de facto standard for terminal
emulation. If xterm does something, we should do the same thing"
([Ghostty's features page](https://ghostty.org/docs/features#terminal-%28vt%29-features)).
"xterm" here means a default xterm: built by `configure` with no options,
running with its default resources, which makes it a VT420. That includes
what it ignores. Where a default xterm ignores a function, because its parse
table drops the sequence or because the function is built only into a
non-default configuration such as `--enable-status-line` or
`--enable-dec-locator`, the cases expect the function to be ignored, and the
page describes what DEC STD 070 or ECMA-48 would have it do. If
libghostty-vt implements such a function, its cases are known differences.

## How the links find a page

The Internet Archive numbers the pages of a scan from 0, whatever is printed
on them. ECMA-48's printed page *N* is the scan's page *N* + 13. DEC STD 070
is a binder of separately numbered sections, so each citation also records
its page of the PDF, and the scan's page is one less than that. Each linked
page was checked against the scan.

---

This is the Markdown version of <https://control-codes.page/sources/>. On that page every validation case runs live in libghostty-vt, the terminal emulation core of Ghostty, compiled to WebAssembly.
