^[control-codes live in libghostty-vt

Control sequences

DECSASD Select Active Status Display

Show a status line below the screen, and send text to it instead of the screen.

CSI Ps $ }
Defaults
Ps = 0, the main display
DEC STD 070
§14.3 Select Active Status Display, p. 14-11
VT510
DECSASD—Select Active Status Display

A DEC terminal can show a status line below the main display. DECSSDT, CSI Ps $ ~, chooses what kind:

PsStatus line
0, or left outnone, the factory default
1an indicator line, which the terminal fills in itself
2a host-writable line, which the host program writes to

DECSASD, CSI Ps $ }, then chooses where what the host sends goes: 0 to the main display, 1 to a host-writable status line. DEC STD 070 defines DECSSDT on p. 14-12, and the VT510 manual as DECSSDT—Select Status Display (Line) Type.

A host-writable status line is a display of its own, one line high. DEC STD 070 says it keeps its own cursor position, rendition, origin mode, character sets and saved cursor (§14.2.2, p. 14-7), and that while it is selected “any data received by the terminal is placed into the Status Display, and most ANSI control functions received will affect only the Status Display” (§14.2.3, p. 14-8). DECSASD can only select it once DECSSDT has made it host-writable: “the Host Writable Status Line must be selected through DECSSDT for DECSASD to be able to select the Host Writable Status Line”. Choosing another status line type with DECSSDT, DECSTR and RIS each send the host back to the main display. The status line is an extension to level 2 and required at level 3.

xterm has both functions only when it is built with --enable-status-line, which is off by default (configure.in). Without it, its parse table turns both sequences into nothing (VTPrsTbl.c). An xterm built with it implements both as DEC STD 070 describes, growing its window by a line for the status line (update_status_line, handle_DECSASD). A default xterm, then, ignores both, and the cases follow it, as the sources page explains: text sent after CSI 1 $ } is written to the main display as if the sequence had never come, and every control acts there too. The case runner shows only the main display, which is all a default xterm has.

Not quite in libghostty-vt

libghostty-vt handles DECSASD, but not DECSSDT, and has no status line to write to. While DECSASD has selected the status line, its print in Terminal.zig returns without doing anything (“If we’re not on the main display, do nothing for now”), so text is discarded where a default xterm would print it. Everything else still acts on the main display, as it does in xterm: the cursor moves and erases erase there. Since DECSSDT does nothing, DECSASD 1 discards text even when there is no host-writable status line to select, and DECSSDT cannot send the host back to the main display. RIS does return to the main display; DECSTR, which libghostty-vt does not implement (see DECSTR), does not. Every case that prints while CSI 1 $ } is in effect is therefore a known difference.

Validation

DECSASD-1: Selecting the status line is ignored

\e[1$}    # DEC STD 070: select the status line, but none is host-writable
AB
\e[0$}
C
|ABC__|
|_____|

DECSASD-2: Text stays on the main display

\e[2$~    # DEC STD 070: a host-writable status line
\e[1$}    # DEC STD 070: select it
AB        # a default xterm prints this on the main display
\e[0$}
C
|ABC__|
|_____|
cursor 1,4

DECSASD-3: Controls act on the main display

XY
\e[2$~
\e[1$}
\e[2J     # DEC STD 070: erases the status line instead
\e[0$}
|_____|
|_____|

DECSASD-4: There is only the main display’s cursor

XY
\e[2$~
\e[1$}
\e[1;5H   # DEC STD 070: moves the status line's cursor instead
\e[0$}
Z
|XY__Z|
|_____|

DECSASD-5: After DECSSDT 0

\e[2$~
\e[1$}
\e[0$~    # DEC STD 070: no status line, so the status display is exited
AB
|AB___|
|_____|

DECSASD-6: After RIS

\e[2$~
\e[1$}
\ec       # RIS
AB
|AB___|
|_____|

DECSASD-7: After DECSTR

\e[2$~
\e[1$}
\e[!p     # DECSTR
AB
|AB___|
|_____|
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.