# Line Feed/New Line Mode (LNM)

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

- **Sequence:** `CSI 20 h`
- **ECMA-48:** [§F.5.2 Line Feed/New Line Mode (LF/NL), p. 88](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n101/mode/1up)
- **DEC STD 070:** [§5.4.4 New Line Mode, p. 5-57](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n311/mode/1up)
- **VT220:** [§4.6.6 Line Feed/New Line Mode (LNM)](https://vt100.net/docs/vt220-rm/chapter4.html#S4.6.6)
- **VT510:** [LNM—Line Feed/New Line Mode](https://vt100.net/docs/vt510-rm/LNM.html)
- **xterm:** [Functions using CSI](https://invisible-island.net/xterm/ctlseqs/ctlseqs.html)

Mode 20 makes a [line feed](https://control-codes.page/c0/lf/index.html.md), [vertical tab](https://control-codes.page/c0/vt/index.html.md) or
[form feed](https://control-codes.page/c0/ff/index.html.md) also move the cursor to the first column, as `CR LF`
would. Reset, which is the default, they only move the cursor down.

| State | Meaning |
| --- | --- |
| Reset, `CSI 20 l` | LF, VT and FF move down only |
| Set, `CSI 20 h` | LF, 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`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/charproc.c#L7399-L7424)), and so does libghostty-vt, and both answer
[DECRQM](https://control-codes.page/csi/decrqm/index.html.md) with its state.

## Validation

### LNM-1: Line feed/new line mode

Input, one step per line:

```text
\e[20h    # LNM
AB
\n
C
\e[20l
\n
D
```

Expected screen:

```text
|AB___|
|C____|
|_D___|
```

### LNM-2: Vertical tab and form feed too

Input, one step per line:

```text
\e[20h    # LNM
AB
\v
C
\f
D
```

Expected screen:

```text
|AB___|
|C____|
|D____|
cursor 3,2
```

### LNM-3: Reset by default

Input, one step per line:

```text
\e[20$p
```

Expected screen:

```text
|_____|
reply \e[20;2$y
```

### LNM-4: Set

Input, one step per line:

```text
\e[20h
\e[20$p
```

Expected screen:

```text
|_____|
reply \e[20;1$y
```

---

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

The validation cases are written in the notation described in <https://control-codes.page/notation/index.html.md>.
