Skip to main content

ghostty_terminal_selection_ordered

Function ghostty_terminal_selection_ordered 

Source
pub unsafe extern "C" fn ghostty_terminal_selection_ordered(
    terminal: Terminal,
    selection: *const Selection,
    desired: Type,
    out_selection: *mut Selection,
) -> Type
Expand description

Return a selection snapshot with endpoints ordered as requested.

Use GHOSTTY_SELECTION_ORDER_FORWARD to get top-left to bottom-right bounds, and GHOSTTY_SELECTION_ORDER_REVERSE to get bottom-right to top-left bounds. Mirrored desired orders are accepted but normalized the same as forward. The output selection is a fresh untracked snapshot and is not installed as the terminal’s current selection.

The selection’s start and end grid refs must both be valid untracked snapshots for the given terminal’s currently active screen. In practice, they must come from that terminal and screen, and no mutating terminal call may have occurred since the refs were produced or reconstructed from tracked refs. Passing refs from another terminal, another screen, or stale refs violates this precondition.

    selection, desired order, or output pointer are invalid. Selection
    reference validity is a precondition and is not checked.