use serde::{Deserialize, Serialize};
#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
pub enum UnderlineStyle {
None,
Single,
Double,
Curly,
Dotted,
Dashed,
}
impl Default for UnderlineStyle {
fn default() -> Self {
UnderlineStyle::None
}
}
#[derive(Debug, Clone)]
pub struct TuiCell {
pub grapheme: String,
pub fg: [f32; 3],
pub bg: Option<[f32; 3]>,
pub bold: bool,
pub italic: bool,
pub underline: UnderlineStyle,
pub strikethrough: bool,
pub link: Option<std::sync::Arc<String>>,
}
impl TuiCell {
pub fn first_char(&self) -> char {
self.grapheme.chars().next().unwrap_or('\0')
}
pub fn is_null(&self) -> bool {
self.grapheme.is_empty() || self.grapheme == "\0"
}
}