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

#include <ghostty/vt/selection.h>

Data Fields

size_t size
GhosttyGridRef start
GhosttyGridRef end
bool rectangle

Detailed Description

A snapshot selection range defined by two grid references.

Both endpoints are inclusive. The endpoints preserve selection direction and may be reversed; callers must not assume that start is the top-left endpoint or that end is the bottom-right endpoint.

When rectangle is false, the endpoints describe a linear selection. When rectangle is true, the same endpoints are interpreted as opposite corners of a rectangular/block selection.

The start and end values are untracked GhosttyGridRef snapshots and are only valid until the next mutating operation on the terminal that produced them unless the selection is reconstructed from tracked references.

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

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

Definition at line 92 of file selection.h.

Field Documentation

◆ end

End of the selection range (inclusive).

This may be before start in terminal order. It is an untracked GhosttyGridRef snapshot and follows untracked grid-ref lifetime rules.

Definition at line 110 of file selection.h.

◆ rectangle

bool rectangle

Whether the endpoints are interpreted as a rectangular/block selection rather than a linear selection.

Definition at line 116 of file selection.h.

◆ size

size_t size

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

Definition at line 94 of file selection.h.

◆ start

Start of the selection range (inclusive).

This may be after end in terminal order. It is an untracked GhosttyGridRef snapshot and follows untracked grid-ref lifetime rules.

Definition at line 102 of file selection.h.


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