Skip to main content

Module paste

Module paste 

Source
Expand description

Terminal protocol, dropped-path, and native clipboard paste handling. Paste handling across terminal protocol, dropped-path classification, and OS clipboards.

[PasteEvents] implements the sans-I/O OSC 5522 conversation, [dropped_paths] classifies terminal drops, and the clipboard functions provide blocking native backends. Terminal and runtime integration belongs beside crate::Terminal.

The clipboard functions block — subprocess bridges are killed after a few seconds, but a wedged native clipboard (a dead X11 connection, a stuck pasteboard) can hold them indefinitely. [spawn_clipboard_read] runs the read on a detached thread reporting through a one-shot channel — never tokio’s blocking pool, which cannot abort a running task and stalls runtime shutdown behind it. Pair the receiver with a deadline to recover from a hung native handle.

Structs§

PasteEvents
Sans-I/O OSC 5522 (kitty enhanced paste) read-offer state machine.
PastedImage
Raw image payload with its sniffed container format.

Enums§

Clipboard
Smart clipboard content, preferring image data over paths and text.
ClipboardRead
Scope of one background clipboard read.
PasteProgress
One step of the OSC 5522 conversation.
Pasted
A completed out-of-band paste delivered by the terminal or clipboard.

Functions§

dropped_paths
Classifies a dropped string as one or more absolute local paths.
is_image_path
Returns whether a path has a supported image extension.
read_clipboard
Reads smart clipboard content, preferring image data, then file paths, then text.
read_clipboard_text
Reads raw clipboard text.
spawn_clipboard_read
Starts one background clipboard read on a detached thread, delivering the result through the returned one-shot channel.
write_clipboard_text
Writes clipboard text, native backend first with CLI bridges as fallback.