# Line Position Absolute (VPA)

> Move the cursor to line n, keeping its column.

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

Move the cursor to line `Pn`, counting from 1, keeping its column. A `0` is
taken as `1`. The VT510 manual says that an attempt to move below the last
line stops on the last line.

It is the vertical counterpart of [HPA](https://control-codes.page/csi/hpa/index.html.md), and like HPA, ECMA-48
defines it for the *data* component, which a terminal does not have apart
from its screen (§6, p. 14). The relative forms are [VPR](https://control-codes.page/csi/vpr/index.html.md) and
[VPB](https://control-codes.page/csi/vpb/index.html.md), and [CUP](https://control-codes.page/csi/cup/index.html.md) sets the line and column together.

The VT510 manual's one-line summary of VPA is a copying error, as it is for
HPA, and so is its "Parameters" entry, which calls `Pn` a column number. 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 | [VPA](https://vt100.net/docs/vt510-rm/VPA.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 |  |
| kitty | 0.49.1, [run in a VM](https://git.jcollie.dev/jeff/control-codes/src/branch/main/emulators/results/kitty.json) | Yes | passes the 3 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) | Yes | passes the 3 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) | Yes | passes the 3 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) | Yes | passes the 3 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) | Yes | passes the 3 cases that show it working |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | Yes | "Moves the cursor to line row"; [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) | Yes | passes the 3 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) | Yes | passes the 3 cases that show it working |

## Validation

### VPA-1: To a line, keeping the column

Input, one step per line:

```text
\e[1;3H
\e[3d
X
```

Expected screen:

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

### VPA-2: To the first line by default

Input, one step per line:

```text
\e[3;2H
\e[d
X
```

Expected screen:

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

### VPA-3: Stops at the last line

Input, one step per line:

```text
\e[1;4H
\e[99d
X
```

Expected screen:

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

---

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