From 8d70338214600a7f808b3e67b6435207076e9ec5 Mon Sep 17 00:00:00 2001 From: Alexandre Bury Date: Wed, 27 May 2015 00:01:23 -0700 Subject: [PATCH] Prints cursor in EditView --- src/view/edit_view.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/view/edit_view.rs b/src/view/edit_view.rs index ce03c44..27816cf 100644 --- a/src/view/edit_view.rs +++ b/src/view/edit_view.rs @@ -65,6 +65,17 @@ impl View for EditView { printer.print((0,0), &self.content); printer.print_hline((self.content.len(),0), printer.size.x-self.content.len(), '_' as u64); }); + + // Now print cursor + if focused { + let c = if self.cursor == self.content.len() { + '_' + } else { + // Get the char from the string... Is it so hard? + self.content[self.cursor..].chars().next().unwrap() + }; + printer.print_hline((self.cursor, 0), 1, c as u64); + } }); }