@@ -14,7 +14,7 @@ use std::time::Duration;
1414use anyhow::Error;
1515
1616use crate::{keymap, Args};
17−use helix_core::{Buffer, State};
17+use helix_core::{state::coords_at_pos, Buffer, State};
1818
1919pub struct BufferComponent<'a> {
2020 x: u16,
@@ -37,8 +37,7 @@ impl BufferComponent<'_> {
3737 SetForegroundColor(Color::Reset),
3838 cursor::MoveTo(self.x + 2, self.y + line_count),
3939 Print(line)
40− )
41− .unwrap();
40+ );
4241 line_count += 1;
4342 }
4443 }
@@ -117,6 +116,16 @@ impl Editor {
117116 // TODO: handle count other than 1
118117 command(state, 1);
119118 self.render();
119+ // render the cursor
120+ let pos = self.state.as_ref().unwrap().selection.primary().head;
121+ let coords = coords_at_pos(
122+ &self.state.as_ref().unwrap().doc.contents.slice(..),
123+ pos,
124+ );
125+ execute!(
126+ stdout(),
127+ cursor::MoveTo((coords.1 + 2) as u16, coords.0 as u16)
128+ );
120129 }
121130 }
122131 }