libghostty-vt 0.0.0
Loading...
Searching...
No Matches
GhosttyTerminalWriteStop Struct Reference

#include <ghostty/vt/terminal.h>

Data Fields

size_t size
size_t consumed
uint32_t reached
GhosttyTerminalStringKind kind
GhosttyTerminalStringIntroducer introducer
GhosttyTerminalStringEnd end
uint8_t byte

Detailed Description

Where ghostty_terminal_vt_write_until() stopped, and why.

This is a sized struct. Initialize it with GHOSTTY_INIT_SIZED() before the first call. See Sized Structs. Each call resets every field except size before it writes the result, so you can reuse one struct across calls.

Fields that don't apply to a stop are zero. Zero is also a valid value for kind, introducer and end, so always check reached first to see which fields apply.

Definition at line 374 of file terminal.h.

Field Documentation

◆ byte

uint8_t byte

The byte that started or ended the string, such as ], 0x90, ESC or BEL. Valid when reached has a START or END flag.

Definition at line 428 of file terminal.h.

◆ consumed

size_t consumed

Number of input bytes consumed, including the byte that reached the boundary. This is 0 when the stream was already at ground and you asked for GHOSTTY_TERMINAL_BOUNDARY_GROUND.

Definition at line 383 of file terminal.h.

◆ end

How the string ended. Valid when reached has an END flag.

Definition at line 422 of file terminal.h.

◆ introducer

How the string started. Valid when reached has a START flag.

Definition at line 419 of file terminal.h.

◆ kind

The kind of string. Valid when reached has a START or END flag.

When one byte both ends a string and starts another, this is the kind of the string that ended. The START flag in reached names the kind that started, since APC_START, DCS_START and OSC_START each belong to one kind.

Definition at line 416 of file terminal.h.

◆ reached

uint32_t reached

The GhosttyTerminalBoundary flags that the stopping byte reached. Only flags you asked for are set, and this is 0 when no boundary was reached.

This is usually one flag. It holds two when a single byte does two things:

  • It ends a string and returns to ground. BEL, CAN, SUB, 0x9C and the other 8-bit control bytes all do this. So if you asked for both OSC_END and GROUND, an OSC_END stop can include GROUND too.
  • It ends one string and starts another. An 8-bit introducer of a different kind does this inside an APC, or inside a DCS header: 0x90 or 0x9D in an APC ends it and starts a DCS or OSC, and 0x9F, 0x98, 0x9E or 0x9D in a DCS header ends it and starts an APC or OSC. The stop has an END flag and a START flag, end is ABORTED and introducer is C1. See ghostty_terminal_vt_write_until() for an example.

A START flag and an END flag of the same kind are never set together.

Definition at line 406 of file terminal.h.

◆ size

size_t size

Size of this struct in bytes. Set by GHOSTTY_INIT_SIZED().

Definition at line 376 of file terminal.h.


The documentation for this struct was generated from the following file: