use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct ResizeEvent {
pub width: u16,
pub height: u16,
}
impl ResizeEvent {
#[must_use]
pub const fn new(width: u16, height: u16) -> Self {
Self { width, height }
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "snake_case")]
pub enum FocusKind {
Gained,
Lost,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub struct FocusEvent {
pub kind: FocusKind,
}
impl FocusEvent {
#[must_use]
pub const fn gained() -> Self {
Self {
kind: FocusKind::Gained,
}
}
#[must_use]
pub const fn lost() -> Self {
Self {
kind: FocusKind::Lost,
}
}
}
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub struct PasteEvent {
pub content: String,
}
impl PasteEvent {
#[must_use]
pub fn new(content: impl Into<String>) -> Self {
Self {
content: content.into(),
}
}
}
#[cfg(test)]
#[path = "terminal_tests.rs"]
mod tests;