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

#include <ghostty/vt/paste.h>

Data Fields

size_t size
GhosttyClipboardLocation location
GhosttyPasteSource source
const GhosttyStringmimes
size_t mimes_len
GhosttyMimeReader reader
bool allow_unsafe

Detailed Description

A paste of clipboard contents into the terminal.

This is a sized struct; set size to sizeof(GhosttyPaste). The MIME type array and the strings it points to are borrowed only for the duration of the ghostty_terminal_paste() call, as is everything the reader produces.

Examples
c-vt-paste/src/main.c.

Definition at line 111 of file paste.h.

Field Documentation

◆ allow_unsafe

bool allow_unsafe

Write text that could inject commands. Call with false, confirm with the user on GHOSTTY_REJECTED, and call again with true.

Examples
c-vt-paste/src/main.c.

Definition at line 156 of file paste.h.

◆ location

The clipboard the contents came from. Reported to the program on a paste event (the selection and primary locations are both reported as the primary selection, the protocol knows only two); no effect on a text paste.

Definition at line 121 of file paste.h.

◆ mimes

const GhosttyString* mimes

Borrowed array of the MIME types of the representations available, in preferred order. A text paste reads and writes the first entry with a text MIME type such as "text/plain" and ignores the rest. A paste event lists every entry and reads none. May be NULL when mimes_len is zero, which is nothing to paste.

Definition at line 133 of file paste.h.

◆ mimes_len

size_t mimes_len

Number of entries in mimes.

Definition at line 136 of file paste.h.

◆ reader

Produces the data of a representation on demand. Required when mimes_len is nonzero.

Called at most once per ghostty_terminal_paste() call: for the text representation being pasted, never for anything else and never for a paste event. The MIME type requested is always an entry of mimes, passed through exactly as given there (the same pointer and length), so the callback may identify the representation by pointer or by content. A false return fails the paste with GHOSTTY_IO_ERROR.

Definition at line 150 of file paste.h.

◆ size

size_t size

Size of this struct in bytes.

Definition at line 113 of file paste.h.

◆ source

Why this paste happened.

Definition at line 124 of file paste.h.


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