pub unsafe extern "C" fn ghostty_terminal_selection_format_alloc(
terminal: Terminal,
allocator: *const Allocator,
options: TerminalSelectionFormatOptions,
out_ptr: *mut *mut u8,
out_len: *mut usize,
) -> TypeExpand description
Format a terminal selection into an allocated buffer.
This is a one-shot convenience API for formatting either the terminal’s active selection or a caller-provided GhosttySelection without explicitly creating a GhosttyFormatter.
The returned buffer is allocated using allocator, or the default allocator if NULL is passed. The caller owns the returned buffer and must free it with ghostty_free(), passing the same allocator and returned length.
The returned bytes are not NUL-terminated. This supports plain text, VT, and HTML uniformly as byte output.
If options.selection is NULL and the terminal has no active selection, the function returns GHOSTTY_NO_VALUE and leaves out_ptr as NULL and out_len as 0.