# Next Line (NEL)

> Move the cursor to the start of the next line, scrolling at the bottom margin.

- **Sequence:** `ESC E`
- **ECMA-48:** [§8.3.86 NEL – Next Line, p. 51](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n64/mode/1up)
- **DEC STD 070:** [§5.4.4 Next Line, p. 5-64](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n318/mode/1up)
- **VT510:** [NEL—Next Line](https://vt100.net/docs/vt510-rm/NEL.html)

Move the cursor to the left margin of the next line. If the cursor is on the
bottom margin, the scrolling region scrolls up by one line instead, exactly
as for a [line feed](https://control-codes.page/c0/lf/index.html.md). DEC STD 070 defines it as a
[carriage return](https://control-codes.page/c0/cr/index.html.md) followed by a line feed, and recommends that
software send `CR LF` instead, "for widest compatibility".

If the cursor is left of the left margin, or above or below the scrolling
region, it goes to the first column of the next line, and never past the last
line of the screen.

NEL is a C1 control. ECMA-48 defines it both as the single byte `85` and as
`ESC E`. A terminal reading UTF-8 accepts only `ESC E`: the code point
U+0085 sent as UTF-8 is ignored, and a lone `85` byte is not valid UTF-8.
A default xterm ignores that byte too when printable text follows it, taking
it as U+0085; libghostty-vt prints U+FFFD, the replacement character, so
that case is a known difference. The [UTF-8](https://control-codes.page/parser/utf8/index.html.md) page has the
details.

## Validation

### NEL-1: Down and back

Input, one step per line:

```text
AB
\eE
C
```

Expected screen:

```text
|AB___|
|C____|
|_____|
cursor 2,2
```

### NEL-2: Scrolls at the bottom

Input, one step per line:

```text
A\r\nB\r\nC
\eE
D
```

Expected screen:

```text
|B____|
|C____|
|D____|
```

### NEL-3: To the left margin

Input, one step per line:

```text
\e[?69h   # allow left and right margins
\e[3;5s   # margins at columns 3 and 5
\e[1;4H
\eE
X
```

Expected screen:

```text
|_____|
|__X__|
```

### NEL-4: The 8-bit forms

*A known difference: libghostty-vt does not pass this case.*

Input, one step per line:

```text
A
\x85       # a lone byte: xterm ignores it before text
B
\u{85}     # U+0085 as UTF-8: ignored
C
```

Expected screen:

```text
|ABC__|
|_____|
```

---

This is the Markdown version of <https://control-codes.page/esc/nel/>. 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>.
