@@ -34,7 +34,27 @@ pub fn prompt(
34 completion_fn: impl FnMut(&Editor, &str) -> Vec<prompt::Completion> + 'static,
34 completion_fn: impl FnMut(&Editor, &str) -> Vec<prompt::Completion> + 'static,
35 callback_fn: impl FnMut(&mut crate::compositor::Context, &str, PromptEvent) + 'static,
35 callback_fn: impl FnMut(&mut crate::compositor::Context, &str, PromptEvent) + 'static,
39+ Prompt::new(prompt, history_register, completion_fn, callback_fn),
43+pub fn prompt_with_input(
44+ cx: &mut crate::commands::Context,
45+ prompt: std::borrow::Cow<'static, str>,
47+ history_register: Option<char>,
48+ completion_fn: impl FnMut(&Editor, &str) -> Vec<prompt::Completion> + 'static,
49+ callback_fn: impl FnMut(&mut crate::compositor::Context, &str, PromptEvent) + 'static,
37− let mut prompt = Prompt::new(prompt, history_register, completion_fn, callback_fn);
53+ Prompt::new(prompt, history_register, completion_fn, callback_fn).with_line(input),
57+fn show_prompt(cx: &mut crate::commands::Context, mut prompt: Prompt) {
38 // Calculate initial completion
58 // Calculate initial completion
39 prompt.recalculate_completion(cx.editor);
59 prompt.recalculate_completion(cx.editor);
40 cx.push_layer(Box::new(prompt));
60 cx.push_layer(Box::new(prompt));