key_bindings/
key_bindings.rs

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