surround_selection/
surround_selection.rs1use lineeditor::style::Style;
2use lineeditor::LineEditor;
3use lineeditor::LineEditorResult;
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
10 let mut style = Style::default();
11 style.set_background_color(lineeditor::Color::Cyan);
12 line_editor.set_visual_selection_style(Some(style));
13 line_editor.enable_surround_selection(true);
14
15 let bindings = line_editor.keybinding();
16 bindings.register_common_control_bindings();
17 bindings.register_common_navigation_bindings();
18 bindings.register_common_edit_bindings();
19 bindings.register_common_selection_bindings();
20
21 match line_editor.read_line() {
22 Ok(LineEditorResult::Success(line)) => {
23 println!("Line {}", line);
24 }
25 _ => {}
26 }
27}