//! Cursor style decision logic (`renderer/cursor.zig`). use ghostty_terminal::render::RenderState; /// Terminal cursor styles (`terminal.CursorStyle`). pub type TerminalCursorStyle = ghostty_terminal::cursor::Style; /// Available cursor styles for drawing that renderers must support. /// This is a superset of terminal cursor styles since the renderer supports /// some additional cursor states such as the hollow block. #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum Style { // Typical cursor input styles Block, BlockHollow, Bar, Underline, // Special cursor styles Lock, } impl Style { /// Create a cursor style from the terminal style request. pub fn from_terminal(term: TerminalCursorStyle) -> Style { match term { TerminalCursorStyle::Bar => Style::Bar, TerminalCursorStyle::Block => Style::Block, TerminalCursorStyle::BlockHollow => Style::BlockHollow, TerminalCursorStyle::Underline => Style::Underline, } } } #[derive(Debug, Clone, Copy, PartialEq, Eq, Default)] pub struct StyleOptions { pub preedit: bool, pub focused: bool, pub blink_visible: bool, } /// Returns the cursor style to use for the current render state or None /// if a cursor should not be rendered at all. pub fn style(state: &RenderState, opts: StyleOptions) -> Option