CPL Cursor Preceding Line
Move the cursor up n lines, to the start of the line.
CSI Pn F
- Defaults
- Pn = 1
- ECMA-48
- §8.3.13 CPL – Cursor Preceding Line, p. 35
- VT510
- CPL—Cursor Previous Line
Move the cursor Pn lines up and to the first character position of that line. A 0 is taken as 1. The VT510 manual calls it Cursor Previous Line.
It is a CUU followed by a carriage return, and behaves as those two do. The cursor stops at the top margin, or the first line if it started above 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 CPL. The VT510 manual does, as does xterm.
Support
| Terminal | Version | Support | Notes |
|---|---|---|---|
| VT220 | manual, 2nd ed., 1984 | No | not in the manual |
| VT510 | manual, 1st ed., 1993 | Yes | CPL |
| xterm | patch 412, xterm-411a | Yes | |
| libghostty-vt | 0f171f6 | Yes | |
| kitty | 0.49.1, run in a VM | Partly | fails CPL-4 of the 4 cases that show it working |
| foot | 1.28.0, run in a VM | Partly | fails CPL-3, CPL-4 of the 4 cases that show it working |
| pyte | 0.8.2, run as a library | Partly | fails CPL-4 of the 4 cases that show it working |
| xterm.js headless | 6.0.0, run as a library | Partly | fails CPL-4 of the 4 cases that show it working |
| alacritty_terminal | 0.26.0, run as a library | Partly | fails CPL-3, CPL-4 of the 4 cases that show it working |
| ConEmu | build 230724, its documentation | Yes | lists ESC [ lines F: ANSI escape codes |
| rxvt-unicode | 9.31, run in a VM | Partly | fails CPL-4 of the 4 cases that show it working |
| VTE | 0.84.1, run as a library | Yes | passes the 4 cases that show it working |
Validation
CPL-1: The previous line
\e[3;3H
\e[F
X
|_____|
|X____|
|_____|
CPL-2: n lines up
\e[3;3H
\e[2F
X
|X____|
|_____|
|_____|
CPL-3: Stops at the top margin, without scrolling
\e[4;1H
A
\e[2;4r # region is lines 2 to 4
\e[3;3H
\e[9F
X
|_____|
|X____|
|_____|
|A____|
CPL-4: To the left margin
\e[?69h # allow left and right margins
\e[2;4s # margins at columns 2 and 4
\e[2;3H
\e[F
X
|_X___|
|_____|