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/terminal.rs | |
parent | 124514aa7024b0cf40bf01def54d280fcc86897c (diff) |
Add other cursor shape
Diffstat (limited to 'helix-tui/src/terminal.rs')
-rw-r--r-- | helix-tui/src/terminal.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/helix-tui/src/terminal.rs b/helix-tui/src/terminal.rs index e8f8f359..b9b2437a 100644 --- a/helix-tui/src/terminal.rs +++ b/helix-tui/src/terminal.rs @@ -14,9 +14,9 @@ pub enum CursorKind { /// █ Block, /// | - // Bar, + Bar, /// _ - // Underline, + Underline, /// Hidden cursor, can set cursor position with this to let IME have correct cursor position. Hidden, } @@ -70,7 +70,7 @@ where fn drop(&mut self) { // Attempt to restore the cursor state if self.hidden_cursor { - if let Err(err) = self.show_cursor() { + if let Err(err) = self.show_cursor(CursorKind::Block) { eprintln!("Failed to show the cursor: {}", err); } } @@ -184,8 +184,8 @@ where } match cursor_kind { - CursorKind::Block => self.show_cursor()?, CursorKind::Hidden => self.hide_cursor()?, + kind => self.show_cursor(kind)?, } // Swap buffers @@ -203,8 +203,8 @@ where Ok(()) } - pub fn show_cursor(&mut self) -> io::Result<()> { - self.backend.show_cursor()?; + pub fn show_cursor(&mut self, kind: CursorKind) -> io::Result<()> { + self.backend.show_cursor(kind)?; self.hidden_cursor = false; Ok(()) } |