@@ -34,7 +34,27 @@ pub fn prompt(
3434 completion_fn: impl FnMut(&Editor, &str) -> Vec<prompt::Completion> + 'static,
3535 callback_fn: impl FnMut(&mut crate::compositor::Context, &str, PromptEvent) + 'static,
3636) {
37− let mut prompt = Prompt::new(prompt, history_register, completion_fn, callback_fn);
37+ show_prompt(
38+ cx,
39+ Prompt::new(prompt, history_register, completion_fn, callback_fn),
40+ );
41+}
42+
43+pub fn prompt_with_input(
44+ cx: &mut crate::commands::Context,
45+ prompt: std::borrow::Cow<'static, str>,
46+ input: String,
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,
50+) {
51+ show_prompt(
52+ cx,
53+ Prompt::new(prompt, history_register, completion_fn, callback_fn).with_line(input),
54+ );
55+}
56+
57+fn show_prompt(cx: &mut crate::commands::Context, mut prompt: Prompt) {
3858 // Calculate initial completion
3959 prompt.recalculate_completion(cx.editor);
4060 cx.push_layer(Box::new(prompt));