libghostty
Loading...
Searching...
No Matches
GhosttyTerminalSelectionFormatOptions Struct Reference

#include <ghostty/vt/selection.h>

Data Fields

size_t size
GhosttyFormatterFormat emit
bool unwrap
bool trim
const GhosttySelectionselection

Detailed Description

Options for one-shot formatting of a terminal selection.

This is a sized struct. Use GHOSTTY_INIT_SIZED() to initialize it.

If selection is NULL, the terminal's current active selection is used. If selection is non-NULL, that caller-provided snapshot selection is used.

The selection is formatted from the terminal's active screen using the same formatting semantics as GhosttyFormatter. For copy/clipboard behavior matching Ghostty's Screen.selectionString(), use plain output with unwrap and trim both set to true.

Examples
c-vt-selection-gesture/src/main.c.

Definition at line 212 of file selection.h.

Field Documentation

◆ emit

Output format to emit.

Examples
c-vt-selection-gesture/src/main.c.

Definition at line 217 of file selection.h.

◆ selection

const GhosttySelection* selection

Optional selection to format.

If NULL, the terminal's current active selection is used. If the terminal has no active selection, formatting returns GHOSTTY_NO_VALUE.

If non-NULL, the pointed-to selection must be a valid snapshot selection for this terminal and must obey GhosttySelection lifetime rules.

Examples
c-vt-selection-gesture/src/main.c.

Definition at line 234 of file selection.h.

◆ size

size_t size

Size of this struct in bytes. Must be set to sizeof(GhosttyTerminalSelectionFormatOptions).

Definition at line 214 of file selection.h.

◆ trim

bool trim

Whether to trim trailing whitespace on non-blank lines.

Examples
c-vt-selection-gesture/src/main.c.

Definition at line 223 of file selection.h.

◆ unwrap

bool unwrap

Whether to unwrap soft-wrapped lines.

Definition at line 220 of file selection.h.


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