^[control-codes
live in libghostty-vt

Control sequences

CNL Cursor Next Line

View as Markdown

Move the cursor down n lines, to the start of the line.

CSI Pn E
Defaults
Pn = 1
ECMA-48
§8.3.12 CNL – Cursor Next Line, p. 35
VT510
CNL—Cursor Next Line

Move the cursor Pn lines down and to the first character position of that line. A 0 is taken as 1.

It is a CUD followed by a carriage return, and behaves as those two do. The cursor stops at the bottom margin, or the last line if it started below the margin, and never scrolls. With left and right margins set, it goes to the left margin rather than the first column.

DEC STD 070 does not define CNL. The VT510 manual does, as does xterm.

Support

TerminalVersionSupportNotes
VT220manual, 2nd ed., 1984Nonot in the manual
VT510manual, 1st ed., 1993YesCNL
xtermpatch 412, xterm-411aYes
libghostty-vt0f171f6Yes
kitty0.49.1, run in a VMPartlyfails CNL-4 of the 4 cases that show it working
foot1.28.0, run in a VMPartlyfails CNL-3, CNL-4 of the 4 cases that show it working
pyte0.8.2, run as a libraryPartlyfails CNL-4 of the 4 cases that show it working
xterm.js headless6.0.0, run as a libraryPartlyfails CNL-4 of the 4 cases that show it working
alacritty_terminal0.26.0, run as a libraryPartlyfails CNL-3, CNL-4 of the 4 cases that show it working
ConEmubuild 230724, its documentationYeslists ESC [ lines E: ANSI escape codes
rxvt-unicode9.31, run in a VMPartlyfails CNL-4 of the 4 cases that show it working
VTE0.84.1, run as a libraryYespasses the 4 cases that show it working

Validation

CNL-1: The next line

\e[1;3H
\e[E
X
|_____|
|X____|
|_____|

CNL-2: n lines down

\e[1;3H
\e[2E
X
|_____|
|_____|
|X____|

CNL-3: Stops at the bottom margin, without scrolling

A
\e[1;3r   # region is lines 1 to 3
\e[2;3H
\e[9E
X
|A____|
|_____|
|X____|
|_____|

CNL-4: To the left margin

\e[?69h   # allow left and right margins
\e[2;4s   # margins at columns 2 and 4
\e[1;3H
\e[E
X
|_____|
|_X___|
Every example on these pages runs in your browser, in libghostty-vt compiled to WebAssembly.