Lokyr
Documentation

VT core

On this page

vt-core does two translations:

It knows nothing about windows, GPUs or plugins, so it can be tested headless and fuzzed. Three crates sit around it: pty (child processes), session (I/O thread and snapshots) and search (search over the grid).

Goals

Parser

Terminal state

Paged grid

The format is inspired by Ghostty's page list.

Cell (64 bits)

BitsField
0–1Content tag: codepoint, codepoint + grapheme, background-only from palette, background-only RGB
2–25Content: codepoint (21 bits), palette index (8 bits) or RGB color (24 bits)
26–41Style id (16 bits) into the page's style table
42–43Width: narrow, wide, spacer-tail, spacer-head
44Protected (DECSCA)
45Has a hyperlink (the id lives in the page's table)
46–47Semantics: output, prompt, input
48–63Reserved (image placeholders, future use)

Row

Each row has compact metadata:

The metadata fits in one byte.

Page

Page list and scrollback

Resizing and reflow

Selection

Inline images

The pictures that programs send, as iTerm2's OSC 1337 File=, or its file in parts (MultipartFile=, FilePart= and FileEnd, as iTerm2's imgcat sends it by default, gathered within the images' memory), and kitty's graphics protocol send them, before 1.0.0, in one store.

Unicode

Settings

The [terminal] section of the config:

[terminal]
term = "xterm-256color"   # what TERM tells programs: xterm-lokyr, xterm-256color, xterm, ansi, vt100, vt220, dtterm, linux…
unicode-widths = "current" # current | 8
ambiguous-width = 1       # 1 | 2
normalization = "none"    # none | nfc | nfd | hfs+

term changes only what programs are told, never the emulation, which stays xterm's: the session puts it in the environment, and the terminal reports it as TN to XTGETTCAP. The other values describe subsets of what xterm does, so they work as they are.

Input

PTY and processes (pty)

Session (session)

Terminfo

Supported protocols

The sequences that the core reads, each with the version that brought it and its specification, are in Escape codes, with how a program finds Lokyr and the exact replies to its queries. Still to come: kitty's graphics' placeholders and the rest of its protocol, and Sixel (DCS q), in F5c; OSC 1337's SetUserVar, CurrentDir, RemoteHost and ShellIntegrationVersion, through a plugin.

Sequences that the core doesn't read are ignored. Debug builds also log them, so the list of missing sequences comes from real sessions.