# Line Position Forward (VPR)

> Move the cursor down n lines, keeping its column.

- **Sequence:** `CSI Pn e`
- **Defaults:** Pn = 1
- **ECMA-48:** [§8.3.160 VPR – Line Position Forward, p. 74](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n87/mode/1up)
- **VT510:** [VPR—Vertical Position Relative](https://vt100.net/docs/vt510-rm/VPR.html)

Move the cursor down `Pn` lines, keeping its column. A `0` is taken as `1`.
The VT510 manual says that an attempt to move below the last line stops at
the last line. It never scrolls.

It is a relative move, so origin mode makes no difference to it: the cursor
moves `Pn` lines from wherever it is.

ECMA-48 names it for the *data* component, which a terminal does not have
apart from its screen (§6, p. 14). Going up is [VPB](https://control-codes.page/csi/vpb/index.html.md), and the
absolute form is [VPA](https://control-codes.page/csi/vpa/index.html.md). The VT510 manual's one-line summary and
"Parameters" entry for VPR are copying errors, as they are for VPA; the
description beneath them is the right one.

## Support

| Terminal | Version | Support | Notes |
| --- | --- | --- | --- |
| VT220 | [manual](https://vt100.net/docs/vt220-rm/), 2nd ed., 1984 | No | not in the manual |
| VT510 | [manual](https://vt100.net/docs/vt510-rm/), 1st ed., 1993 | Yes | [VPR](https://vt100.net/docs/vt510-rm/VPR.html) |
| xterm | patch 412, [xterm-411a](https://github.com/ThomasDickey/xterm-snapshots/tree/xterm-411a) | Yes |  |
| libghostty-vt | [0f171f6](https://github.com/ghostty-org/ghostty/tree/0f171f650a1cbbd6df4a2573b6b0c7de57cc6d90) | Yes | VPR-4: in origin mode the move is offset by the top and left margins |
| kitty | 0.49.1, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/kitty.json) | Partly | fails VPR-4 of the 4 cases that show it working |
| foot | 1.28.0, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/foot.json) | Partly | fails VPR-4 of the 4 cases that show it working |
| pyte | 0.8.2, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/pyte.json) | Partly | fails VPR-4 of the 4 cases that show it working |
| xterm.js headless | 6.0.0, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/xtermjs.json) | Partly | fails VPR-4 of the 4 cases that show it working |
| alacritty_terminal | 0.26.0, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/alacritty.json) | Partly | fails VPR-4 of the 4 cases that show it working |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | No | not in ConEmu's list; [ANSI escape codes](https://conemu.github.io/en/AnsiEscapeCodes.html) |
| rxvt-unicode | 9.31, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/urxvt.json) | Partly | fails VPR-4 of the 4 cases that show it working |
| VTE | 0.84.1, [run as a library](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/vte.json) | No | fails the 4 cases that show it working |

## Validation

### VPR-1: One line by default

Input, one step per line:

```text
\e[1;2H
\e[e
X
```

Expected screen:

```text
|_____|
|_X___|
|_____|
```

### VPR-2: n lines

Input, one step per line:

```text
\e[1;4H
\e[2e
X
```

Expected screen:

```text
|_____|
|_____|
|___X_|
```

### VPR-3: Stops at the last line, without scrolling

Input, one step per line:

```text
A
\e[2;3H
\e[99e
X
```

Expected screen:

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

### VPR-4: The same in origin mode

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

Input, one step per line:

```text
\e[2;5r   # region is lines 2 to 5
\e[?69h   # allow left and right margins
\e[2;6s   # margins at columns 2 and 6
\e[?6h    # origin mode
\e[1;2H   # line 2, column 3 of the screen
X
\e[2e
Y
\e[?6l
```

Expected screen:

```text
|_______|
|__X____|
|_______|
|___Y___|
|_______|
```

The `Y` should be two lines below the cell after `X`, which is what
esctest2's `test_VPR_IgnoresOriginMode` checks. libghostty-vt puts it
further down and further right. VPR there is
`setCursorPos(current line + 1 + Pn, current column + 1)`, and in origin
mode `setCursorPos` adds the margins to both, so the move is offset by the
top margin and the column by the left margin.

---

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