Skip to main content

Module clipboard

Module clipboard 

Source
Expand description

System-clipboard abstraction (CB.0).

The editor talks to the OS clipboard through this single trait so the backend (native arboard, OSC52 terminal escape, gpui-native, or an in-memory fake for tests) is swappable and renderer-neutral. Registered in the ServiceRegistry at boot as ClipboardHandle so both the host’s register layer AND mode crates (terminal-mode, which routes paste to the PTY — CB.3) can reach it without depending on lattice-host.

Threading contract (paramount #1). Clipboard I/O is an OS round-trip (X11 / Wayland can be slow); it must never sit on the UI / keystroke path. Clipboard::read is only ever called from a spawn_blocking context (the paste path); Clipboard::write is fire-and-forget — a backend that would block spawns its own blocking task internally and returns immediately.

See docs/dev/architecture/clipboard.md.

Structs§

FakeClipboard
In-memory Clipboard for tests / headless CI and the default boot binding before a real backend is installed (CB.2 / CB.4). Thread-safe; round-trips text without touching any OS resource.

Traits§

Clipboard
The OS clipboard, behind a swappable backend.

Type Aliases§

ClipboardHandle
Cheap-clone handle for the clipboard service, stored in the ServiceRegistry. Per the ServiceRegistry Arc/TypeId rule, register AND look up under this exact type (services.get::<ClipboardHandle>()), never under a concrete backend type.