|
|
@ -16,7 +16,7 @@ use helix_view::{
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
pub type Completion = (RangeFrom<usize>, Cow<'static, str>);
|
|
|
|
pub type Completion = (RangeFrom<usize>, Cow<'static, str>);
|
|
|
|
type PromptCharHandler = Box<dyn Fn(&mut Prompt, char, &Context)>;
|
|
|
|
type PromptCharHandler = Box<dyn Fn(&mut Prompt, char, &mut Context)>;
|
|
|
|
|
|
|
|
|
|
|
|
pub struct Prompt {
|
|
|
|
pub struct Prompt {
|
|
|
|
prompt: Cow<'static, str>,
|
|
|
|
prompt: Cow<'static, str>,
|
|
|
@ -193,7 +193,7 @@ impl Prompt {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
pub fn insert_char(&mut self, c: char, cx: &Context) {
|
|
|
|
pub fn insert_char(&mut self, c: char, cx: &mut Context) {
|
|
|
|
if let Some(handler) = &self.next_char_handler.take() {
|
|
|
|
if let Some(handler) = &self.next_char_handler.take() {
|
|
|
|
handler(self, c, cx);
|
|
|
|
handler(self, c, cx);
|
|
|
|
|
|
|
|
|
|
|
@ -549,7 +549,11 @@ impl Component for Prompt {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ctrl!('q') => self.exit_selection(),
|
|
|
|
ctrl!('q') => self.exit_selection(),
|
|
|
|
ctrl!('r') => {
|
|
|
|
ctrl!('r') => {
|
|
|
|
|
|
|
|
self.completion = Vec::new(); //clear completions
|
|
|
|
|
|
|
|
cx.editor.autoinfo =
|
|
|
|
|
|
|
|
Some(helix_view::info::Info::from_registers(&cx.editor.registers)); // show registers info
|
|
|
|
self.next_char_handler = Some(Box::new(|prompt, c, context| {
|
|
|
|
self.next_char_handler = Some(Box::new(|prompt, c, context| {
|
|
|
|
|
|
|
|
context.editor.autoinfo = None;
|
|
|
|
prompt.insert_str(
|
|
|
|
prompt.insert_str(
|
|
|
|
context
|
|
|
|
context
|
|
|
|
.editor
|
|
|
|
.editor
|
|
|
|