MCPcopy Create free account
hub / github.com/ChrisFeldmeier/OpenCodeRust / write_osc52

Function write_osc52

crates/opencode-tui/src/ui/clipboard.rs:96–109  ·  view source on GitHub ↗
(text: &str)

Source from the content-addressed store, hash-verified

94}
95
96fn write_osc52(text: &str) {
97 let encoded = base64::engine::general_purpose::STANDARD.encode(text.as_bytes());
98 let osc52 = format!("\x1b]52;c;{encoded}\x07");
99
100 let sequence = if std::env::var("TMUX").is_ok() || std::env::var("STY").is_ok() {
101 format!("\x1bPtmux;\x1b{osc52}\x1b\\")
102 } else {
103 osc52
104 };
105
106 let _ = std::io::stdout()
107 .write_all(sequence.as_bytes())
108 .and_then(|_| std::io::stdout().flush());
109}
110
111fn read_with_command(program: &str, args: &[&str]) -> anyhow::Result<String> {
112 let output = Command::new(program)

Callers 1

write_textMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected