From 871631bb00dc4e531f0490927d5d7a73209cd249 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 19 Sep 2023 17:11:33 +1000 Subject: [PATCH] Trigger auto completion refresh when necessary on completion select This removes the timing dependent behaviour where `Tab` would only display the completion menu if pressed before the prompt idle timeout This means `exec :dc` now expands 'dc' to 'define-command' instead of just showing the completion menu a few millis early. --- src/input_handler.cc | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/input_handler.cc b/src/input_handler.cc index a5c88a21..5b60026e 100644 --- a/src/input_handler.cc +++ b/src/input_handler.cc @@ -931,8 +931,10 @@ public: else if (key == Key::Tab or key == shift(Key::Tab) or key.modifiers == Key::Modifiers::MenuSelect) // completion { CandidateList& candidates = m_completions.candidates; - // first try, we need to ask our completer for completions - if (candidates.empty()) + + if (m_auto_complete and m_refresh_completion_pending) + refresh_completions(CompletionFlags::Fast); + if (candidates.empty()) // manual completion, we need to ask our completer for completions { refresh_completions(CompletionFlags::None); if ((not m_prefix_in_completions and candidates.size() > 1) or