From 24f90ba8d8f4a10fb18f71b05c278fe89b71a261 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bla=C5=BE=20Hrastnik?= Date: Thu, 17 Feb 2022 13:56:01 +0900 Subject: [PATCH] Manually recalculate initial completion where it matters --- helix-term/src/commands.rs | 2 ++ helix-term/src/ui/mod.rs | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 9cf5630da..c07f44dcc 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -3393,6 +3393,8 @@ fn command_mode(cx: &mut Context) { None }); + // Calculate initial completion + prompt.recalculate_completion(cx.editor); cx.push_layer(Box::new(prompt)); } diff --git a/helix-term/src/ui/mod.rs b/helix-term/src/ui/mod.rs index e9ff9d1a3..e269c8edd 100644 --- a/helix-term/src/ui/mod.rs +++ b/helix-term/src/ui/mod.rs @@ -38,7 +38,7 @@ pub fn regex_prompt( let snapshot = doc.selection(view_id).clone(); let offset_snapshot = view.offset; - Prompt::new( + let mut prompt = Prompt::new( prompt, history_register, completion_fn, @@ -91,7 +91,10 @@ pub fn regex_prompt( } } }, - ) + ); + // Calculate initial completion + prompt.recalculate_completion(cx.editor); + prompt } pub fn file_picker(root: PathBuf, config: &helix_view::editor::Config) -> FilePicker {