# Page Movement (NP, PP, PPA, PPR, PPB)

> Move to another page of display memory, on terminals that have more than one.

- **Sequence:** `CSI Pn U`
- **Defaults:** Pn = 1
- **ECMA-48:** [§8.3.87 NP – Next Page, p. 51](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n64/mode/1up)
- **DEC STD 070:** [§5.4.7 Next Page, p. 5-77](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n331/mode/1up)
- **VT510:** [NP—Next Page](https://vt100.net/docs/vt510-rm/NP.html)

Some DEC terminals keep several *pages* of display memory, of which the
screen shows one. These five functions move the cursor among them:

| Sequence | Function | Moves the cursor to |
| --- | --- | --- |
| `CSI Pn U` | NP, next page | the home position, `Pn` pages on |
| `CSI Pn V` | PP, preceding page | the home position, `Pn` pages back |
| `CSI Pn SP P` | PPA, page position absolute | the same line and column on page `Pn` |
| `CSI Pn SP Q` | PPR, page position relative | the same line and column, `Pn` pages on |
| `CSI Pn SP R` | PPB, page position backward | the same line and column, `Pn` pages back |

That is DEC STD 070's definition, in §5.4.7 from
[p. 5-77](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n331/mode/1up).
A request past the last page goes to the last page, and one before the first
goes to the first. ECMA-48 defines NP and PP as showing another page, and
says their effect on the cursor "is not defined by this Standard"; its
PPA, PPR and PPB are §8.3.96, §8.3.98 and §8.3.97, all on
[p. 53](https://archive.org/details/ecma-48-5th-edition-june-1991/page/n66/mode/1up).
The VT510 manual has [PP](https://vt100.net/docs/vt510-rm/PP.html),
[PPA](https://vt100.net/docs/vt510-rm/PPA.html),
[PPR](https://vt100.net/docs/vt510-rm/PPR.html) and
[PPB](https://vt100.net/docs/vt510-rm/PPB.html).

DEC STD 070 makes page movement part of levels 3 and 4 only. libghostty-vt
has a single page and identifies itself as a level 2 terminal (see
[DA](https://control-codes.page/csi/da/index.html.md)), so it does not implement any of these, and DEC STD 070
says unimplemented functions "shall be ignored as if they were not received"
([§3.5.1.3, p. 3-20](https://archive.org/details/bitsavers_decstandar0VideoSystemsReferenceManualDec91_74264381/page/n124/mode/1up)).
xterm does not implement them either.

## Validation

### NP-1: Ignored on a level 2 terminal

Input, one step per line:

```text
\e[2;3H
\e[U      # NP
X
```

Expected screen:

```text
|_____|
|__X__|
|_____|
cursor 2,4
```

### NP-2: PP is ignored too

Input, one step per line:

```text
\e[2;3H
\e[V      # PP
X
```

Expected screen:

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

### NP-3: And the three with an intermediate byte

Input, one step per line:

```text
\e[2;3H
\e[2\sP   # PPA
\e[\sQ    # PPR
\e[\sR    # PPB
X
```

Expected screen:

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

---

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