@@ -4,7 +4,7 @@
44
55use crossterm::event::Event;
66use helix_core::Position;
7−use tui::{buffer::Buffer as Surface, layout::Rect};
7+use tui::{buffer::Buffer as Surface, layout::Rect, terminal::CursorKind};
88
99pub type Callback = Box<dyn FnOnce(&mut Compositor)>;
1010
@@ -47,8 +47,9 @@ pub trait Component: Any + AnyComponent {
4747 /// Render the component onto the provided surface.
4848 fn render(&self, area: Rect, frame: &mut Surface, ctx: &mut Context);
4949
50− fn cursor_position(&self, area: Rect, ctx: &Editor) -> Option<Position> {
51− None
50+ /// Get cursor position and cursor kind.
51+ fn cursor(&self, area: Rect, ctx: &Editor) -> (Option<Position>, CursorKind) {
52+ (None, CursorKind::Hidden)
5253 }
5354
5455 /// May be used by the parent component to compute the child area.
@@ -137,20 +138,19 @@ impl Compositor {
137138 layer.render(area, surface, cx)
138139 }
139140
140− let pos = self
141− .cursor_position(area, cx.editor)
142− .map(|pos| (pos.col as u16, pos.row as u16));
141+ let (pos, kind) = self.cursor(area, cx.editor);
142+ let pos = pos.map(|pos| (pos.col as u16, pos.row as u16));
143143
144− self.terminal.draw(pos);
144+ self.terminal.draw(pos, kind);
145145 }
146146
147− pub fn cursor_position(&self, area: Rect, editor: &Editor) -> Option<Position> {
147+ pub fn cursor(&self, area: Rect, editor: &Editor) -> (Option<Position>, CursorKind) {
148148 for layer in self.layers.iter().rev() {
149− if let Some(pos) = layer.cursor_position(area, editor) {
150− return Some(pos);
149+ if let (Some(pos), kind) = layer.cursor(area, editor) {
150+ return (Some(pos), kind);
151151 }
152152 }
153− None
153+ (None, CursorKind::Hidden)
154154 }
155155
156156 pub fn find(&mut self, type_name: &str) -> Option<&mut dyn Component> {