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
| Parameter | Description | Default |
|---|---|---|
Pn | Number of lines to move | 1 |
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 thePn-th following line. - CPL (
CSI Pn F) — Moves the cursor to the first character position of thePn-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
| Specification | Section |
|---|---|
| ECMA-48 | — |
Terminal support
| Terminal | Support | Version | Notes |
|---|---|---|---|
| Terminal Emulators | |||
| Alacritty | ✓ | 0.2.1 | Added in version 0.2.1 per changelog |
| Bobcat | ✓ | 0.9.0 | Supported via TerminalCtrl library |
| contour | ✓ | v0.1.0 | |
| foot | ✓ | Yes | CNL (E) at csi.c:908-912, CPL (F) at csi.c:914-918 |
| Ghostty | ✓ | v1.0.0 | |
| iTerm2 | ✓ | Yes | VT100CSI_CNL/CPL tokens parsed and executed via terminalCursorDown/Up with andToStartOfLine:YES |
| Kitty | ✓ | Yes | CNL/CPL (CSI E/F) fully implemented in vt-parser.c:1204-1207 |
| Konsole | ✓ | Yes | CNL (E), CPL (F) implemented at src/Vt102Emulation.cpp:2128-2129 |
| mintty | ✓ | Yes | CNL (CSI E) at line 3161-3162, CPL (CSI F) at line 3163-3164 |
| mlterm | ✓ | rel-2_9_0 | Implemented 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 | ✓ | Yes | Fully implemented in vteseq.cc as CNL/CPL handlers |
| WezTerm | ✓ | Yes | CNL (NextLine) and CPL (PrecedingLine) implemented as Cursor::NextLine and Cursor::PrecedingLine |
| Windows Terminal | ✓ | Yes | Implemented 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.6 | CNL (CSI E) and CPL (CSI F) both implemented |
| tuios | ✓ | v0.0.15 | |
| Zellij | ✓ | v0.9.0 | |
See also
- CUU/CUD/CUF/CUB — Relative Cursor Movement — Move without changing column/row
- CHA/CUP — Absolute Cursor Positioning — Absolute positioning