summaryrefslogtreecommitdiff
path: root/helix-term/src/ui/prompt.rs
diff options
context:
space:
mode:
authorIvan Tham2021-06-15 05:03:56 +0000
committerIvan Tham2021-06-15 15:46:21 +0000
commit124514aa7024b0cf40bf01def54d280fcc86897c (patch)
treee4fa3e9566755d40bd322578fd25f7de99b28377 /helix-term/src/ui/prompt.rs
parent6bdf609caaf4eb1c137f503f147d1e4e4f3e8676 (diff)
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.
Diffstat (limited to 'helix-term/src/ui/prompt.rs')
-rw-r--r--helix-term/src/ui/prompt.rs14
1 files changed, 9 insertions, 5 deletions
diff --git a/helix-term/src/ui/prompt.rs b/helix-term/src/ui/prompt.rs
index c388c315..7b8af820 100644
--- a/helix-term/src/ui/prompt.rs
+++ b/helix-term/src/ui/prompt.rs
@@ -4,6 +4,7 @@ use crossterm::event::{Event, KeyCode, KeyEvent, KeyModifiers};
use helix_core::Position;
use helix_view::{Editor, Theme};
use std::{borrow::Cow, ops::RangeFrom};
+use tui::terminal::CursorKind;
pub type Completion = (RangeFrom<usize>, Cow<'static, str>);
@@ -342,11 +343,14 @@ impl Component for Prompt {
self.render_prompt(area, surface, cx)
}
- fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> {
+ fn cursor(&self, area: Rect, editor: &Editor) -> (Option<Position>, CursorKind) {
let line = area.height as usize - 1;
- Some(Position::new(
- area.y as usize + line,
- area.x as usize + self.prompt.len() + self.cursor,
- ))
+ (
+ Some(Position::new(
+ area.y as usize + line,
+ area.x as usize + self.prompt.len() + self.cursor,
+ )),
+ CursorKind::Block,
+ )
}
}