Skip to main content

write_drag_drop

Function write_drag_drop 

Source
pub fn write_drag_drop<W: Write>(
    w: &mut W,
    options: &[&str],
    payload: &[u8],
) -> Result<()>
Expand description

Write one OSC 72 message without flushing.

Options are joined with :. The payload separator is omitted when the payload is empty. Options and payload are written verbatim: callers must supply escape-safe metadata, encode binary data as base64, and split payloads to meet the protocol’s 4096-byte limit.

This function frames the supplied bytes and propagates output errors.

use uncurses::ansi::drag_drop::write_drag_drop;

let mut bytes = Vec::new();
write_drag_drop(&mut bytes, &["t=m", "o=1"], b"text/plain")?;
assert_eq!(bytes, b"\x1b]72;t=m:o=1;text/plain\x1b\\");