Skip to main content

CNL/CPL

AI-Generated Content
This page was generated with the assistance of AI and may contain inaccuracies. It is intended as a placeholder for future human verification. If you spot issues ahead of its initial review, please report them on GitHub!
Standard

CNL (Cursor Next Line) and CPL (Cursor Preceding Line) are CSI sequences that move the cursor to the first column of a line relative to the current position.

Syntax​

CSI Pn E      CNL — Cursor Next Line
CSI Pn F CPL — Cursor Preceding Line
Formal syntax
CNL = 0x1b, "[", [ Pn ], "E" ;
CPL = 0x1b, "[", [ Pn ], "F" ;
Pn  = digit, { digit } ;                (* default: 1 *)
digit = "0" | "1" | "2" | "3" | "4"
    | "5" | "6" | "7" | "8" | "9" ;

Parameters​

ParameterDescriptionDefault
PnNumber of lines to move1

Description​

Per ECMA-48 §8.3.12 (CNL) and §8.3.13 (CPL):

  • CNL (CSI Pn E) — Moves the cursor to the first character position of the Pn-th following line.
  • CPL (CSI Pn F) — Moves the cursor to the first character position of the Pn-th preceding line.

These are equivalent to CUD/CUU followed by a move to column 1. The cursor does not scroll the display when it reaches the margin.

Examples​

printf '\e[3E'       # Move to column 1 of 3rd line below
printf '\e[2F' # Move to column 1 of 2nd line above

Specifications​

SpecificationSection
ECMA-48—

Terminal support​

TerminalSupportVersionNotes
Terminal Emulators
Alacritty✓0.2.1Added in version 0.2.1 per changelog
Bobcat✓0.9.0Supported via TerminalCtrl library
contour✓v0.1.0
foot✓YesCNL (E) at csi.c:908-912, CPL (F) at csi.c:914-918
Ghostty✓v1.0.0
iTerm2✓YesVT100CSI_CNL/CPL tokens parsed and executed via terminalCursorDown/Up with andToStartOfLine:YES
Kitty✓YesCNL/CPL (CSI E/F) fully implemented in vt-parser.c:1204-1207
Konsole✓YesCNL (E), CPL (F) implemented at src/Vt102Emulation.cpp:2128-2129
mintty✓YesCNL (CSI E) at line 3161-3162, CPL (CSI F) at line 3163-3164
mlterm✓rel-2_9_0Implemented at vt_parser.c:5598-5615
PuTTY✓0.45
Rio✓v0.0.3
rxvt-unicode✓1.2
st✓0.1
terminology✓v1.4.0
VT100✗No
VTE✓YesFully implemented in vteseq.cc as CNL/CPL handlers
WezTerm✓YesCNL (NextLine) and CPL (PrecedingLine) implemented as Cursor::NextLine and Cursor::PrecedingLine
Windows Terminal✓YesImplemented in ITermDispatch.hpp:45-46 as CursorNextLine and CursorPrevLine
xterm✓xterm-406
xterm.js✓2.3.0
Multiplexers
cy✓v0.1.0
GNU Screen✓v.4.2.0
tmux✓1.6CNL (CSI E) and CPL (CSI F) both implemented
tuios✓v0.0.15
Zellij✓v0.9.0

See also​