1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
//! The single funnel for clipboard copies, wrapping the helper from the
//! `tui-panel-select` crate (a local clipboard tool when available, else an
//! OSC 52 escape sequence).
//!
//! The implementation lives in that crate so it can be reused across TUI
//! apps; PaperBoy consumes it here under the original module path.
//!
//! Everything that copies must go through *this* wrapper rather than calling
//! the crate directly, because of the `cfg(test)` guard below.
/// Copy `text` to the system clipboard, best-effort.
///
/// Under `cargo test` this is pinned to [`ClipboardMode::None`] so the suite
/// cannot touch the developer's real desktop clipboard. The upstream crate
/// cannot do this for us: its own `cfg(test)` is only set while *it* is being
/// tested, and is inert when it is built as our dependency. Our `cfg(test)`,
/// on the other hand, is set precisely when we want it to be.
///
/// The mode is pinned here, on every call, rather than once during test setup
/// because there is no single entry point every test passes through — doing it
/// at the funnel means a new test cannot forget.
///
/// [`ClipboardMode::None`]: tui_panel_select::ClipboardMode::None
pub