From 124514aa7024b0cf40bf01def54d280fcc86897c Mon Sep 17 00:00:00 2001 From: Ivan Tham Date: Tue, 15 Jun 2021 13:03:56 +0800 Subject: Add cursor kind to separate hidden cursor from pos Now IME cursor position should be correct since we can still set cursor position without drawing the cursor. --- helix-term/src/ui/editor.rs | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'helix-term/src/ui/editor.rs') diff --git a/helix-term/src/ui/editor.rs b/helix-term/src/ui/editor.rs index 5913df29..95587b4c 100644 --- a/helix-term/src/ui/editor.rs +++ b/helix-term/src/ui/editor.rs @@ -26,6 +26,7 @@ use tui::{ buffer::Buffer as Surface, layout::Rect, style::{Color, Modifier, Style}, + terminal::CursorKind, }; pub struct EditorView { @@ -739,15 +740,12 @@ impl Component for EditorView { } } - fn cursor_position(&self, area: Rect, editor: &Editor) -> Option { + fn cursor(&self, area: Rect, editor: &Editor) -> (Option, CursorKind) { // match view.doc.mode() { // Mode::Insert => write!(stdout, "\x1B[6 q"), // mode => write!(stdout, "\x1B[2 q"), // }; - // return editor.cursor_position() - - // It's easier to just not render the cursor and use selection rendering instead. - None + editor.cursor() } } -- cgit v1.2.3-70-g09d2