Skip to main content

Module clipboard

Module clipboard 

Source
Expand description

CB.2 / CB.4 (docs/dev/architecture/clipboard.md §4): the TUI’s lattice_core::Clipboard backend. Two implementations composed by TuiClipboard::detect:

  • Osc52Clipboard — terminal escape-sequence write. No link deps, always compiled in. Read-back is unsupported (most terminals block the OSC52 read half for security reasons), so read always returns None and callers fall back to the in-memory register. This is the TUI-specific half (writing escape codes to stdout only makes sense for a terminal), so it lives here rather than in the shared host module.
  • [lattice_host::clipboard::ArboardClipboard] (behind the system-clipboard feature) — native OS clipboard via arboard, the shared backend both renderer peers use (CB.4 moved it to lattice-host so the bounded-read logic isn’t duplicated; see that module’s doc). Feature-gated because it pulls X11/Wayland link libs; lattice-ui-tui/system-clipboard forwards to lattice-host/system-clipboard.

TuiClipboard::detect() prefers OSC52 under SSH even when arboard would technically succeed: over ssh -X, arboard can connect to the forwarded X server, but writes there land in the remote X server’s clipboard, not the user’s local machine clipboard. OSC52 tunnels through the terminal escape codes to the local terminal emulator directly, which is the semantically correct backend for SSH sessions.

Structs§

Osc52Clipboard
OSC52 clipboard-write escape sequence (ESC ] 52 ; c ; <base64> BEL, c = the clipboard selection). No system-lib dependency; the write-only fallback for headless / SSH sessions and for builds without the system-clipboard feature.

Enums§

TuiClipboard
The TUI’s clipboard backend: native when available, OSC52 write-only otherwise. See the module doc for the SSH-preference rule.