feat: copy the output panel to the system clipboard (#11)

New app-level `copy` / `copy all` / `copy last` command (ADR-0041).
Delivery is OSC 52 *and* a best-effort native write (arboard), always
both — OSC 52 acceptance is undetectable, so a true fallback can't be
built. Payload is the panel's plain text exactly as rendered (tags,
✓/✗, box-drawing), drift-locked to render_output_line. arboard added
--no-default-features (X11-only; OSC 52 covers Wayland).

Amends ADR-0003's command registry; requirements V6.
This commit is contained in:
claude@clouddev1
2026-06-02 14:23:21 +00:00
parent 1ea376be26
commit d0c8f9d5d2
25 changed files with 1203 additions and 13 deletions
+32
View File
@@ -129,6 +129,38 @@ fn messages_with_value_parses() {
crate::snap!("messages_verbose", a);
}
#[test]
fn copy_with_no_value_parses() {
// Copy scope is optional — bare `copy` copies the whole panel.
let a = assess_at_end("copy", &schema_empty());
assert!(matches!(a.state, InputState::Valid));
assert_eq!(a.parse_result.as_deref(), Ok("App(Copy)"));
crate::snap!("copy_no_value", a);
}
#[test]
fn copy_all_parses() {
let a = assess_at_end("copy all", &schema_empty());
assert!(matches!(a.state, InputState::Valid));
assert_eq!(a.parse_result.as_deref(), Ok("App(Copy)"));
crate::snap!("copy_all", a);
}
#[test]
fn copy_last_parses() {
let a = assess_at_end("copy last", &schema_empty());
assert!(matches!(a.state, InputState::Valid));
assert_eq!(a.parse_result.as_deref(), Ok("App(Copy)"));
crate::snap!("copy_last", a);
}
#[test]
fn copy_space_offers_all_and_last() {
let a = assess_at_end("copy ", &schema_empty());
assert_candidate_present(&a, &["all", "last"]);
crate::snap!("copy_space", a);
}
#[test]
fn partial_entry_word_classifies_as_definite_error_but_completes() {
// `qu` — mid-typing the `quit` entry word.
+1
View File
@@ -257,6 +257,7 @@ fn command_kind_label(cmd: &rdbms_playground::dsl::Command) -> String {
AppCommand::Messages { .. } => "App(Messages)".into(),
AppCommand::Undo => "App(Undo)".into(),
AppCommand::Redo => "App(Redo)".into(),
AppCommand::Copy { .. } => "App(Copy)".into(),
},
}
}
@@ -0,0 +1,20 @@
---
source: tests/typing_surface/app_commands.rs
assertion_line: 146
description: "input=\"copy all\" cursor=8"
expression: "& a"
---
Assessment {
input: "copy all",
cursor: 8,
state: Valid,
hint: Some(
Prose(
"Submit with Enter",
),
),
completion: None,
parse_result: Ok(
"App(Copy)",
),
}
@@ -0,0 +1,20 @@
---
source: tests/typing_surface/app_commands.rs
assertion_line: 154
description: "input=\"copy last\" cursor=9"
expression: "& a"
---
Assessment {
input: "copy last",
cursor: 9,
state: Valid,
hint: Some(
Prose(
"Submit with Enter",
),
),
completion: None,
parse_result: Ok(
"App(Copy)",
),
}
@@ -0,0 +1,52 @@
---
source: tests/typing_surface/app_commands.rs
assertion_line: 161
description: "input=\"copy \" cursor=5"
expression: "& a"
---
Assessment {
input: "copy ",
cursor: 5,
state: Valid,
hint: Some(
Candidates {
items: [
Candidate {
text: "all",
kind: Keyword,
mode: Both,
},
Candidate {
text: "last",
kind: Keyword,
mode: Both,
},
],
selected: None,
},
),
completion: Some(
Completion {
replaced_range: (
5,
5,
),
partial_prefix: "",
candidates: [
Candidate {
text: "all",
kind: Keyword,
mode: Both,
},
Candidate {
text: "last",
kind: Keyword,
mode: Both,
},
],
},
),
parse_result: Ok(
"App(Copy)",
),
}
@@ -0,0 +1,20 @@
---
source: tests/typing_surface/app_commands.rs
assertion_line: 138
description: "input=\"copy\" cursor=4"
expression: "& a"
---
Assessment {
input: "copy",
cursor: 4,
state: Valid,
hint: Some(
Prose(
"Submit with Enter",
),
),
completion: None,
parse_result: Ok(
"App(Copy)",
),
}