Skip to main content

Module clipboard

Module clipboard 

Source
Expand description

The system clipboard, reached two ways, and the shapes a copy takes.

native: the display server via arboard. On Wayland the copy lives only while datui runs, unless a clipboard manager keeps it. Tabular copies offer text/html (a real table) beside plain text, so spreadsheets and email paste a table and terminals paste TSV.

osc52: an OSC 52 escape for the terminal, which works over SSH. Written straight to stdout (the ratatui buffer is sanitized by crate::sanitize). Terminals cap OSC 52, so payloads are capped first (configurable); table copies are read in batches up to the cap, without an HTML flavor.

auto: native where it initializes, else osc52, decided at the first copy.

Structs§

Accepts
What a destination takes, known before a copy is built.
Native
arboard, kept alive for the life of the app: on Wayland and X11 the copy dies with the process that owns it, so dropping the handle early would revoke the copy the flash just announced.
Osc52
The OSC 52 writer. Carries only the cap; stdout is fetched per write.
Payload
One copy, ready for whichever destination takes it. The text flavor is always there; the HTML flavor rides along when the copy is a table and the destination can offer both.

Enums§

BackendChoice
Which clipboard mechanism [clipboard] backend asks for.
CopyFormat
The formats the dialog offers for tabular scopes.

Traits§

Destination
Somewhere a payload can go. A trait so the integration tests can hand the app a destination that only records what it was given.

Functions§

base64_len
The length of bytes bytes in padded base64.
bounded_table_text
A table copy’s text and row count, read from lf in batches and abandoned at the first batch past limit base64 bytes, so a copy the terminal refuses is never built whole. Text only. Upstream operations (sorts, joins) still take their memory; Markdown holds rows until widths are known, bounded by the cap.
delimited
A DataFrame as delimited text quoted as spreadsheets parse pastes (QuoteStyle::Necessary). Raw values as in export; null is empty, never ∅.
destination
The destination a backend choice names, built at the first copy.
html_table
A DataFrame as an HTML table, the rich flavor beside a TSV or CSV copy. Everything is escaped; a null is an empty cell.
markdown
A DataFrame as a Markdown table, always with a header (the delimiter row makes it a table). Numbers right-aligned, pipes escaped, newlines flattened to spaces.
osc52_sequence
The OSC 52 sequence setting the clipboard, or why not; separate from Osc52::write so tests can read the bytes. Size is checked before encoding.
tabular_payload
A tabular copy’s payload: the chosen format as text, plus HTML beside TSV or CSV when html asks. Markdown stays Markdown. Lists and structs are JSON, as in CSV export.