^[control-codes
live in libghostty-vt

ANSI modes

LNM Line Feed/New Line Mode

View as Markdown

Make a line feed return to the first column as well.

CSI 20 h/l
ECMA-48
§F.5.2 Line Feed/New Line Mode (LF/NL), p. 88
DEC STD 070
§5.4.4 New Line Mode, p. 5-57
VT220
§4.6.6 Line Feed/New Line Mode (LNM)
VT510
LNM—Line Feed/New Line Mode
xterm
Functions using CSI

Mode 20 makes a line feed, vertical tab or form feed also move the cursor to the first column, as CR LF would. Reset, which is the default, they only move the cursor down.

StateMeaning
Reset, CSI 20 lLF, VT and FF move down only
Set, CSI 20 hLF, VT and FF also return to the first column

It is not in ECMA-48 any more. The fourth edition deprecated it and the fifth, the one this site follows, removed it, so mode 20 is now “shall not be used”. DEC terminals still have it: DEC STD 070 defines it, and says that conforming software should not set it. The VT510 manual adds that the mode also decides what the Return key sends, and advises keeping it reset for compatibility with Digital’s software.

xterm keeps the mode (ansi_modes), and so does libghostty-vt, and both answer DECRQM with its state.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Yes§4.6.6 Line Feed/New Line Mode (LNM)
VT510manual, 1st ed., 1993YesLNM
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yes
kitty0.49.1, run in a VMYespasses the 4 cases that show it working
foot1.28.0, run in a VMNofails the 4 cases that show it working
pyte0.8.2, run as a libraryYespasses the 2 cases that show it working
xterm.js headless6.0.0, run as a libraryYespasses the 4 cases that show it working
alacritty_terminal0.26.0, run as a libraryPartlyfails LNM-1, LNM-2 of the 4 cases that show it working
ConEmubuild 230724, its documentationYesANSI escape codes
rxvt-unicode9.31, run in a VMNofails the 4 cases that show it working
VTE0.84.1, run as a libraryNofails the 4 cases that show it working

Validation

LNM-1: Line feed/new line mode

\e[20h    # LNM
AB
\n
C
\e[20l
\n
D
|AB___|
|C____|
|_D___|

LNM-2: Vertical tab and form feed too

\e[20h    # LNM
AB
\v
C
\f
D
|AB___|
|C____|
|D____|
cursor 3,2

LNM-3: Reset by default

\e[20$p
|_____|
reply \e[20;2$y

LNM-4: Set

\e[20h
\e[20$p
|_____|
reply \e[20;1$y
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.