^[control-codes
live in libghostty-vt

ANSI modes

VEM Line Editing Mode

View as Markdown

Which way lines move when one is inserted or deleted.

CSI 7 h/l
ECMA-48
§7.2.19 VEM – Line Editing Mode, p. 25
DEC STD 070
§5.10.1.3 Modes That Cannot Be Changed, p. 5-134

Mode 7 decides which lines move when a line is inserted with IL or deleted with DL. DEC STD 070 calls it Vertical Editing Mode.

StateECMA-48 calls itMeaning
Reset, CSI 7 lFOLLOWINGthe active line and those below it move down for an insertion, and up to close a deletion
Set, CSI 7 hPRECEDINGthe lines above move up for an insertion, and down to close a deletion

DEC STD 070 §5.10.1.3, p. 5-134 lists it among the X3.64 modes a DEC terminal may treat as fixed, as reset. The VT510 manual’s table of modes for DECRPM marks it as always reset. That is the way IL and DL work in xterm and libghostty-vt.

xterm ignores CSI 7 h and CSI 7 l (ansi_modes handles only modes 2, 4, 12 and 20), and DECRQM reports the mode as permanently reset, 4 (do_ansi_rqm). libghostty-vt ignores it too, but does not recognize the number, so it answers DECRQM with 0. Both DECRQM cases are known differences.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Nonot in the manual, whose table of ANSI modes has only KAM, IRM, SRM and LNM
VT510manual, 1st ed., 1993Nolisted as permanently reset
xtermpatch 412, xterm-411aNoignored; DECRQM reports it permanently reset, 4
libghostty-vt0f171f6Noignored; DECRQM answers 0 (VEM-1, VEM-2)
ConEmubuild 230724, its documentationNoCSI 7 ; col h is its own line wrapping instead (ANSI escape codes)

Validation

VEM-1: Reported as permanently reset

\e[7$p
|_____|
reply \e[7;4$y

VEM-2: Even after it is set

\e[7h
\e[7$p
|_____|
reply \e[7;4$y

VEM-3: IL still pushes the lines below down

A\r\n
B\r\n
C
\e[7h      # ignored
\e[2;1H
\e[L
|A__|
|___|
|B__|
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.