cursor_style/
cursor_style.rs1use lineeditor::LineEditor;
2use lineeditor::LineEditorResult;
3use lineeditor::SetCursorStyle;
4use lineeditor::StringPrompt;
5
6fn main() {
7 let prompt = StringPrompt::new("prompt> ".to_string());
8 let mut line_editor = LineEditor::new(Box::new(prompt));
9 line_editor.set_cursor_style(Some(SetCursorStyle::BlinkingBlock));
10
11 let bindings = line_editor.keybinding();
12 bindings.register_common_control_bindings();
13
14 match line_editor.read_line() {
15 Ok(LineEditorResult::Success(line)) => {
16 println!("Line {}", line);
17 }
18 _ => {}
19 }
20}