Prints cursor in EditView

This commit is contained in:
Alexandre Bury 2015-05-27 00:01:23 -07:00
parent c3496c9870
commit 8d70338214

View File

@ -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);
}
});
}