|
|
@ -19,7 +19,7 @@ pub type Completion = (RangeFrom<usize>, Cow<'static, str>);
|
|
|
|
|
|
|
|
|
|
|
|
pub struct Prompt {
|
|
|
|
pub struct Prompt {
|
|
|
|
prompt: Cow<'static, str>,
|
|
|
|
prompt: Cow<'static, str>,
|
|
|
|
pub line: String,
|
|
|
|
line: String,
|
|
|
|
cursor: usize,
|
|
|
|
cursor: usize,
|
|
|
|
completion: Vec<Completion>,
|
|
|
|
completion: Vec<Completion>,
|
|
|
|
selection: Option<usize>,
|
|
|
|
selection: Option<usize>,
|
|
|
@ -77,6 +77,10 @@ impl Prompt {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
pub fn line(&self) -> &String {
|
|
|
|
|
|
|
|
&self.line
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn recalculate_completion(&mut self, editor: &Editor) {
|
|
|
|
pub fn recalculate_completion(&mut self, editor: &Editor) {
|
|
|
|
self.completion = (self.completion_fn)(editor, &self.line);
|
|
|
|
self.completion = (self.completion_fn)(editor, &self.line);
|
|
|
|
}
|
|
|
|
}
|
|
|
|