diff --git a/src/editor.rs b/src/editor.rs index d964b2a..94a5a5e 100644 --- a/src/editor.rs +++ b/src/editor.rs @@ -31,6 +31,14 @@ pub struct Style { pub blend: u8 } +#[derive(new, Debug, Clone, PartialEq)] +pub struct ModeInfo { + #[new(default)] + pub cursor_type: Option, + #[new(default)] + pub cursor_style_id: Option +} + pub type GridCell = Option<(char, Style)>; #[derive(new, Debug, Clone)] @@ -41,21 +49,34 @@ pub struct DrawCommand { pub style: Style } -#[derive(Clone)] +#[derive(Debug, Clone, PartialEq)] pub enum CursorType { Block, Horizontal, Vertical } +impl CursorType { + pub fn from_type_name(name: &str) -> Option { + match name { + "block" => Some(CursorType::Block), + "horizontal" => Some(CursorType::Horizontal), + "vertical" => Some(CursorType::Vertical), + _ => None + } + } +} + pub struct Editor { pub nvim: Neovim, pub grid: Vec>, pub cursor_pos: (u64, u64), pub cursor_type: CursorType, + pub cursor_style: Option