# Line Position Backward (VPB)

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

- **Sequence:** `CSI Pn k`
- **Defaults:** Pn = 1
- **ECMA-48:** [§8.3.159 VPB – Line Position Backward, p. 74](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n87/mode/1up)

Move the cursor up `Pn` lines, keeping its column. A `0` is taken as `1`.

ECMA-48 defines it, as the counterpart of [VPR](https://control-codes.page/csi/vpr/index.html.md), for the *data*
component, which a terminal does not have apart from its screen (§6, p. 14).
Neither the VT510 manual nor xterm's documentation lists it, and xterm
ignores it: its parse table sends `CSI … k` straight back to the ground
state ([`VTPrsTbl.c`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/VTPrsTbl.c#L609-L613)). The cases follow xterm, as
the [sources](https://control-codes.page/sources/index.html.md) page explains, and expect the cursor not to move.

libghostty-vt implements VPB as [CUU](https://control-codes.page/csi/cuu/index.html.md): the same final-byte handler
serves both, so it moves the cursor up, stopping at the top line, or at the
top margin when it starts inside the scrolling region, and never scrolling.
That makes every case below a known difference.

## Validation

### VPB-1: Ignored, with the default

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

Input, one step per line:

```text
\e[3;2H
\e[k      # ECMA-48: one line up
X
```

Expected screen:

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

### VPB-2: Ignored, with a count

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

Input, one step per line:

```text
\e[3;4H
\e[2k     # ECMA-48: two lines up
X
```

Expected screen:

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

### VPB-3: Ignored, with a count past the first line

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

Input, one step per line:

```text
\e[2;3H
A
\e[2;3H
\e[99k    # ECMA-48: as far up as the first line
X
```

Expected screen:

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

---

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