diff options
Diffstat (limited to 'helix-tui/src/backend/crossterm.rs')
-rw-r--r-- | helix-tui/src/backend/crossterm.rs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs index f6703e14..189f9dce 100644 --- a/helix-tui/src/backend/crossterm.rs +++ b/helix-tui/src/backend/crossterm.rs @@ -3,9 +3,10 @@ use crate::{ buffer::Cell, layout::Rect, style::{Color, Modifier}, + terminal::CursorKind, }; use crossterm::{ - cursor::{Hide, MoveTo, Show}, + cursor::{CursorShape, Hide, MoveTo, SetCursorShape, Show}, execute, queue, style::{ Attribute as CAttribute, Color as CColor, Print, SetAttribute, SetBackgroundColor, @@ -93,8 +94,14 @@ where map_error(execute!(self.buffer, Hide)) } - fn show_cursor(&mut self) -> io::Result<()> { - map_error(execute!(self.buffer, Show)) + fn show_cursor(&mut self, kind: CursorKind) -> io::Result<()> { + let shape = match kind { + CursorKind::Block => CursorShape::Block, + CursorKind::Bar => CursorShape::Line, + CursorKind::Underline => CursorShape::UnderScore, + CursorKind::Hidden => unreachable!(), + }; + map_error(execute!(self.buffer, Show, SetCursorShape(shape))) } fn get_cursor(&mut self) -> io::Result<(u16, u16)> { |