Skip to main content

rusty_bubbletea/
paste.rs

1//! Cleanroom Rust port of upstream Go source file: `paste.go`
2//! Upstream Target Tag / Version: `v2.0.8`
3//!
4//! <public-docs>
5//! # Bracketed Paste Messages
6//!
7//! Paste messages (`PasteMsg`, `PasteStartMsg`, `PasteEndMsg`) emitted when receiving bracketed paste text.
8//! </public-docs>
9
10use std::fmt;
11
12/// PasteMsg is a message that is emitted when a terminal receives pasted text
13/// using bracketed-paste.
14#[derive(Debug, Clone, PartialEq, Eq)]
15pub struct PasteMsg {
16    /// Pasted string content.
17    pub content: String,
18}
19
20impl fmt::Display for PasteMsg {
21    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
22        write!(f, "{}", self.content)
23    }
24}
25
26/// PasteStartMsg is a message that is emitted when the terminal starts the
27/// bracketed-paste text.
28#[derive(Debug, Clone, Copy, PartialEq, Eq)]
29pub struct PasteStartMsg;
30
31/// PasteEndMsg is a message that is emitted when the terminal ends the
32/// bracketed-paste text.
33#[derive(Debug, Clone, Copy, PartialEq, Eq)]
34pub struct PasteEndMsg;