# Remote Graphic Instruction Set (ReGIS)

> Enter DEC's vector graphics language, whose commands draw lines, curves and text until ST.

- **Sequence:** `DCS Pm p commands ST`
- **Defaults:** Pm = 0
- **VT330/VT340:** [§1.8 Entering and Exiting ReGIS](https://vt100.net/docs/vt3xx-gp/chapter1.html#S1.8)

ReGIS is DEC's language for vector graphics: commands such as `P[100,100]`
to move the graphics cursor, `V[200,200]` to draw a line to a point, `C` for
circles and arcs, `T` for text, and `S(E)` to erase the screen. A
[device control string](https://control-codes.page/esc/dcs/index.html.md) with the final byte `p`, and no
intermediate byte, enters it, and [ST](https://control-codes.page/esc/st/index.html.md) leaves it. The VT330/VT340
manual describes the language in its first thirteen chapters, and how it is
entered in [§1.8](https://vt100.net/docs/vt3xx-gp/chapter1.html#S1.8). The
parameter says where to begin and whether to echo what is received:

| `Pm` | Begins | Displays the commands |
| --- | --- | --- |
| `0`, or none | where ReGIS was last left | no |
| `1` | at a new command | no |
| `2` | where ReGIS was last left | on the bottom line |
| `3` | at a new command | on the bottom line |

The bottom-line display, *command display mode*, shows the commands as they
are received, up to 80 characters, and is cleared by a line feed.

The VT125, the VT240 and the VT330 and VT340 have ReGIS; the VT510 does not.
xterm has it only when built with `--enable-regis-graphics`, which `configure`
leaves off
([`configure.in`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/configure.in#L1087-L1100)),
and then only as a graphics terminal, as for [sixels](https://control-codes.page/dcs/sixel/index.html.md). A
default xterm collects the string and drops it at ST
([`misc.c`](https://github.com/ThomasDickey/xterm-snapshots/blob/xterm-411a/misc.c#L5352-L5364)).
Nothing is drawn, nothing is displayed on the bottom line, and that is what
the cases expect, as the [sources](https://control-codes.page/sources/index.html.md) page explains.

The same final byte has a second use: tmux's control mode is entered with
`DCS 1000 p`, a ReGIS string with a parameter ReGIS does not define.

## Not in libghostty-vt

libghostty-vt has no ReGIS. The only `DCS p` its handler in `dcs.zig`
recognizes is tmux's `DCS 1000 p`, and only in a build with tmux control mode;
any other is dropped. That is what a default xterm does, so both cases pass.

## Support

| Terminal | Version | Support | Notes |
| --- | --- | --- | --- |
| VT220 | [manual](https://vt100.net/docs/vt220-rm/), 2nd ed., 1984 | No | the VT220 has no graphics |
| VT340 | [manual](https://vt100.net/docs/vt3xx-gp/), vol. 2, 2nd ed., 1988 | Yes | [§1.8 Entering and Exiting ReGIS](https://vt100.net/docs/vt3xx-gp/chapter1.html#S1.8) |
| VT510 | [manual](https://vt100.net/docs/vt510-rm/), 1st ed., 1993 | No | the VT510 manual has no ReGIS |
| xterm | patch 412, [xterm-411a](https://github.com/ThomasDickey/xterm-snapshots/tree/xterm-411a) | No | consumed and ignored; ReGIS needs `--enable-regis-graphics`, off by default |
| libghostty-vt | [83edd49](https://github.com/ghostty-org/ghostty/tree/83edd491e3024ae5e50393d62877b8897da1cccd) | No | the string is dropped; only tmux's `DCS 1000 p` is recognized |
| Konsole | 26.11.70, [a24c3d71](https://invent.kde.org/utilities/konsole/-/tree/a24c3d71be3684f24d030aa2dbe9bd723d985233) | No | no ReGIS; its DCS hook handles only sixels |
| ConEmu | build 230724, its [documentation](https://conemu.github.io/en/AnsiEscapeCodes.html) | No | not in ConEmu's list, which has no DCS; [ANSI escape codes](https://conemu.github.io/en/AnsiEscapeCodes.html) |

## Validation

### REGIS-1: Nothing is drawn

Input, one step per line:

```text
A
\eP1pS(E)P[100,100]V[200,200]\e\\   # erase, then draw a line
B
```

Expected screen:

```text
|AB____|
|______|
cursor 1,3
reply none
```

### REGIS-2: Command display mode shows nothing either

Input, one step per line:

```text
A
\eP3pP[100,100]V[200,200]\e\\
```

Expected screen:

```text
|A_____|
|______|
|______|
cursor 1,2
```

---

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