freya_core/style/
cursor.rs

1#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
2#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
3pub enum CursorStyle {
4    Line = 0,
5    Block = 1,
6    Underline = 2,
7}
8
9impl Default for CursorStyle {
10    fn default() -> Self {
11        Self::Line
12    }
13}
14
15impl CursorStyle {
16    pub fn pretty(&self) -> String {
17        match self {
18            Self::Line => "line".to_string(),
19            Self::Block => "block".to_string(),
20            Self::Underline => "underline".to_string(),
21        }
22    }
23}
24
25/// Determines how the cursor and highlights are positioned within a Paragraph.
26#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
27#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq, Default)]
28pub enum CursorMode {
29    /// Cursor and highlights use the paragraph's visible_area.
30    /// VerticalAlign affects cursor/highlight positions.
31    #[default]
32    Fit,
33    /// Cursor and highlights use the paragraph's inner_area.
34    /// VerticalAlign does NOT affect cursor/highlight positions.
35    Expanded,
36}
37
38impl CursorMode {
39    pub fn pretty(&self) -> String {
40        match self {
41            Self::Fit => "fit".to_string(),
42            Self::Expanded => "expanded".to_string(),
43        }
44    }
45}