Cursor in input field

This commit is contained in:
Greg Shuflin committed 2024-03-09 02:39:10 -08:00
1 parent d2e56dba4b
commit 0a88196b85
1 file changed
+10 -6
+10 -6
View File
@@ -144,13 +144,17 @@ impl TerminalState {
}
fn render_command(&mut self, frame: &mut Frame, core: &EditorCore, rect: Rect) {
let line = if let Some(ref cmd) = core.current_command() {
format!(":{cmd}").into()
} else {
"".into()
};
//TODO maybe different cursor style for command buffer
let cursor_style = cursor_style(&core);
frame.render_widget(Paragraph::new(vec![line]).white().on_black(), rect);
if let Some(ref cmd) = core.current_command() {
let cursor = Span::styled(" ", cursor_style).into();
let line = Line::from(vec![format!(":{cmd}").into(), cursor]);
frame.render_widget(Paragraph::new(vec![line]).white().on_black(), rect);
} else {
let line = ":".into();
frame.render_widget(Paragraph::new(vec![line]).dark_gray().on_black(), rect);
}
}
}