diff options
author | Ivan Tham | 2021-06-15 05:27:53 +0000 |
---|---|---|
committer | Ivan Tham | 2021-06-15 15:46:21 +0000 |
commit | 33a35b7589dbc35f43f8823b79591ca857bceeac (patch) | |
tree | 564ed18b66a0e038fd5d74c434c42e1f8475b03b /helix-tui/src/backend/crossterm.rs | |
parent | 124514aa7024b0cf40bf01def54d280fcc86897c (diff) |
Add other cursor shape
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)> { |