@@ -10,7 +10,6 @@ pub struct Prompt {
10 pub line: String,
10 pub line: String,
11 pub cursor: usize,
11 pub cursor: usize,
12 pub completion: Vec<String>,
12 pub completion: Vec<String>,
13− pub should_close: bool,
14 pub completion_selection_index: Option<usize>,
13 pub completion_selection_index: Option<usize>,
15 completion_fn: Box<dyn FnMut(&str) -> Vec<String>>,
14 completion_fn: Box<dyn FnMut(&str) -> Vec<String>>,
16 callback_fn: Box<dyn FnMut(&mut Editor, &str)>,
15 callback_fn: Box<dyn FnMut(&mut Editor, &str)>,
@@ -27,7 +26,6 @@ impl Prompt {
27 line: String::new(),
26 line: String::new(),
28 cursor: 0,
27 cursor: 0,
29 completion: completion_fn(""),
28 completion: completion_fn(""),
31 completion_selection_index: None,
29 completion_selection_index: None,
32 completion_fn: Box::new(completion_fn),
30 completion_fn: Box::new(completion_fn),
33 callback_fn: Box::new(callback_fn),
31 callback_fn: Box::new(callback_fn),
@@ -42,9 +40,7 @@ impl Prompt {
44 pub fn move_char_left(&mut self) {
42 pub fn move_char_left(&mut self) {
46− self.cursor -= 1;
43+ self.cursor = self.cursor.saturating_sub(1)
50 pub fn move_char_right(&mut self) {
46 pub fn move_char_right(&mut self) {