From 96a4eb84838d4cbfb9313968278985ea1986a3bc Mon Sep 17 00:00:00 2001 From: Blaž Hrastnik Date: Tue, 22 Mar 2022 23:25:40 +0900 Subject: Remove more push_layer calls --- helix-term/src/ui/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'helix-term/src/ui') diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index 3c39a517..a90debdb 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -26,6 +26,19 @@ use helix_view::{Document, Editor, View}; use std::path::PathBuf; +pub fn prompt( + cx: &mut crate::commands::Context, + prompt: std::borrow::Cow<'static, str>, + history_register: Option, + completion_fn: impl FnMut(&Editor, &str) -> Vec + 'static, + callback_fn: impl FnMut(&mut crate::compositor::Context, &str, PromptEvent) + 'static, +) { + let mut prompt = Prompt::new(prompt, history_register, completion_fn, callback_fn); + // Calculate initial completion + prompt.recalculate_completion(cx.editor); + cx.push_layer(Box::new(prompt)); +} + pub fn regex_prompt( cx: &mut crate::commands::Context, prompt: std::borrow::Cow<'static, str>, -- cgit v1.2.3-70-g09d2