libghostty
Loading...
Searching...
No Matches
Screen

Detailed Description

Terminal screen cell and row types.

These types represent the contents of a terminal screen. A GhosttyCell is a single grid cell and a GhosttyRow is a single row. Both are opaque values whose fields are accessed via ghostty_cell_get() and ghostty_row_get() respectively.

Typedefs

typedef uint64_t GhosttyCell
typedef uint64_t GhosttyRow

Enumerations

enum  GhosttyCellContentTag { GHOSTTY_CELL_CONTENT_CODEPOINT = 0 , GHOSTTY_CELL_CONTENT_CODEPOINT_GRAPHEME = 1 , GHOSTTY_CELL_CONTENT_BG_COLOR_PALETTE = 2 , GHOSTTY_CELL_CONTENT_BG_COLOR_RGB = 3 }
enum  GhosttyCellWide { GHOSTTY_CELL_WIDE_NARROW = 0 , GHOSTTY_CELL_WIDE_WIDE = 1 , GHOSTTY_CELL_WIDE_SPACER_TAIL = 2 , GHOSTTY_CELL_WIDE_SPACER_HEAD = 3 }
enum  GhosttyCellSemanticContent { GHOSTTY_CELL_SEMANTIC_OUTPUT = 0 , GHOSTTY_CELL_SEMANTIC_INPUT = 1 , GHOSTTY_CELL_SEMANTIC_PROMPT = 2 }
enum  GhosttyCellData {
  GHOSTTY_CELL_DATA_INVALID = 0 , GHOSTTY_CELL_DATA_CODEPOINT = 1 , GHOSTTY_CELL_DATA_CONTENT_TAG = 2 , GHOSTTY_CELL_DATA_WIDE = 3 ,
  GHOSTTY_CELL_DATA_HAS_TEXT = 4 , GHOSTTY_CELL_DATA_HAS_STYLING = 5 , GHOSTTY_CELL_DATA_STYLE_ID = 6 , GHOSTTY_CELL_DATA_HAS_HYPERLINK = 7 ,
  GHOSTTY_CELL_DATA_PROTECTED = 8 , GHOSTTY_CELL_DATA_SEMANTIC_CONTENT = 9
}
enum  GhosttyRowSemanticPrompt { GHOSTTY_ROW_SEMANTIC_NONE = 0 , GHOSTTY_ROW_SEMANTIC_PROMPT = 1 , GHOSTTY_ROW_SEMANTIC_PROMPT_CONTINUATION = 2 }
enum  GhosttyRowData {
  GHOSTTY_ROW_DATA_INVALID = 0 , GHOSTTY_ROW_DATA_WRAP = 1 , GHOSTTY_ROW_DATA_WRAP_CONTINUATION = 2 , GHOSTTY_ROW_DATA_GRAPHEME = 3 ,
  GHOSTTY_ROW_DATA_STYLED = 4 , GHOSTTY_ROW_DATA_HYPERLINK = 5 , GHOSTTY_ROW_DATA_SEMANTIC_PROMPT = 6 , GHOSTTY_ROW_DATA_KITTY_VIRTUAL_PLACEHOLDER = 7 ,
  GHOSTTY_ROW_DATA_DIRTY = 8
}

Functions

GhosttyResult ghostty_cell_get (GhosttyCell cell, GhosttyCellData data, void *out)
GhosttyResult ghostty_row_get (GhosttyRow row, GhosttyRowData data, void *out)

Typedef Documentation

◆ GhosttyCell

typedef uint64_t GhosttyCell

Opaque cell value.

Represents a single terminal cell. The internal layout is opaque and must be queried via ghostty_cell_get(). Obtain cell values from terminal query APIs.

Examples
c-vt-grid-traverse/src/main.c.

Definition at line 39 of file screen.h.

◆ GhosttyRow

typedef uint64_t GhosttyRow

Opaque row value.

Represents a single terminal row. The internal layout is opaque and must be queried via ghostty_row_get(). Obtain row values from terminal query APIs.

Examples
c-vt-grid-traverse/src/main.c.

Definition at line 50 of file screen.h.

Enumeration Type Documentation

◆ GhosttyCellContentTag

Cell content tag.

Describes what kind of content a cell holds.

Enumerator
GHOSTTY_CELL_CONTENT_CODEPOINT 

A single codepoint (may be zero for empty).

GHOSTTY_CELL_CONTENT_CODEPOINT_GRAPHEME 

A codepoint that is part of a multi-codepoint grapheme cluster.

GHOSTTY_CELL_CONTENT_BG_COLOR_PALETTE 

No text; background color from palette.

GHOSTTY_CELL_CONTENT_BG_COLOR_RGB 

No text; background color as RGB.

Definition at line 59 of file screen.h.

◆ GhosttyCellData

Cell data types.

These values specify what type of data to extract from a cell using ghostty_cell_get.

Enumerator
GHOSTTY_CELL_DATA_INVALID 

Invalid data type. Never results in any data extraction.

GHOSTTY_CELL_DATA_CODEPOINT 

The codepoint of the cell (0 if empty or bg-color-only).

Output type: uint32_t *

GHOSTTY_CELL_DATA_CONTENT_TAG 

The content tag describing what kind of content is in the cell.

Output type: GhosttyCellContentTag *

GHOSTTY_CELL_DATA_WIDE 

The wide property of the cell.

Output type: GhosttyCellWide *

GHOSTTY_CELL_DATA_HAS_TEXT 

Whether the cell has text to render.

Output type: bool *

GHOSTTY_CELL_DATA_HAS_STYLING 

Whether the cell has non-default styling.

Output type: bool *

GHOSTTY_CELL_DATA_STYLE_ID 

The style ID for the cell (for use with style lookups).

Output type: uint16_t *

GHOSTTY_CELL_DATA_HAS_HYPERLINK 

Whether the cell has a hyperlink.

Output type: bool *

GHOSTTY_CELL_DATA_PROTECTED 

Whether the cell is protected.

Output type: bool *

GHOSTTY_CELL_DATA_SEMANTIC_CONTENT 

The semantic content type of the cell (from OSC 133).

Output type: GhosttyCellSemanticContent *

Definition at line 121 of file screen.h.

◆ GhosttyCellSemanticContent

Semantic content type of a cell.

Set by semantic prompt sequences (OSC 133) to distinguish between command output, user input, and shell prompt text.

Enumerator
GHOSTTY_CELL_SEMANTIC_OUTPUT 

Regular output content, such as command output.

GHOSTTY_CELL_SEMANTIC_INPUT 

Content that is part of user input.

GHOSTTY_CELL_SEMANTIC_PROMPT 

Content that is part of a shell prompt.

Definition at line 102 of file screen.h.

◆ GhosttyCellWide

Cell wide property.

Describes the width behavior of a cell.

Enumerator
GHOSTTY_CELL_WIDE_NARROW 

Not a wide character, cell width 1.

GHOSTTY_CELL_WIDE_WIDE 

Wide character, cell width 2.

GHOSTTY_CELL_WIDE_SPACER_TAIL 

Spacer after wide character. Do not render.

GHOSTTY_CELL_WIDE_SPACER_HEAD 

Spacer at end of soft-wrapped line for a wide character.

Definition at line 80 of file screen.h.

◆ GhosttyRowData

Row data types.

These values specify what type of data to extract from a row using ghostty_row_get.

Enumerator
GHOSTTY_ROW_DATA_INVALID 

Invalid data type. Never results in any data extraction.

GHOSTTY_ROW_DATA_WRAP 

Whether this row is soft-wrapped.

Output type: bool *

GHOSTTY_ROW_DATA_WRAP_CONTINUATION 

Whether this row is a continuation of a soft-wrapped row.

Output type: bool *

GHOSTTY_ROW_DATA_GRAPHEME 

Whether any cells in this row have grapheme clusters.

Output type: bool *

GHOSTTY_ROW_DATA_STYLED 

Whether any cells in this row have styling (may have false positives).

Output type: bool *

GHOSTTY_ROW_DATA_HYPERLINK 

Whether any cells in this row have hyperlinks (may have false positives).

Output type: bool *

GHOSTTY_ROW_DATA_SEMANTIC_PROMPT 

The semantic prompt state of this row.

Output type: GhosttyRowSemanticPrompt *

GHOSTTY_ROW_DATA_KITTY_VIRTUAL_PLACEHOLDER 

Whether this row contains a Kitty virtual placeholder.

Output type: bool *

GHOSTTY_ROW_DATA_DIRTY 

Whether this row is dirty and requires a redraw.

Output type: bool *

Definition at line 216 of file screen.h.

◆ GhosttyRowSemanticPrompt

Row semantic prompt state.

Indicates whether any cells in a row are part of a shell prompt, as reported by OSC 133 sequences.

Enumerator
GHOSTTY_ROW_SEMANTIC_NONE 

No prompt cells in this row.

GHOSTTY_ROW_SEMANTIC_PROMPT 

Prompt cells exist and this is a primary prompt line.

GHOSTTY_ROW_SEMANTIC_PROMPT_CONTINUATION 

Prompt cells exist and this is a continuation line.

Definition at line 197 of file screen.h.

Function Documentation

◆ ghostty_cell_get()

GhosttyResult ghostty_cell_get ( GhosttyCell cell,
GhosttyCellData data,
void * out )

Get data from a cell.

Extracts typed data from the given cell based on the specified data type. The output pointer must be of the appropriate type for the requested data kind. Valid data types and output types are documented in the GhosttyCellData enum.

Parameters
cellThe cell value
dataThe type of data to extract
outPointer to store the extracted data (type depends on data parameter)
Returns
GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the data type is invalid
Examples
c-vt-grid-traverse/src/main.c.

◆ ghostty_row_get()

GhosttyResult ghostty_row_get ( GhosttyRow row,
GhosttyRowData data,
void * out )

Get data from a row.

Extracts typed data from the given row based on the specified data type. The output pointer must be of the appropriate type for the requested data kind. Valid data types and output types are documented in the GhosttyRowData enum.

Parameters
rowThe row value
dataThe type of data to extract
outPointer to store the extracted data (type depends on data parameter)
Returns
GHOSTTY_SUCCESS on success, GHOSTTY_INVALID_VALUE if the data type is invalid
Examples
c-vt-grid-traverse/src/main.c.