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<tab>` now expands 'dc' to 'define-command'
instead of just showing the completion menu a few millis early.
main
Maxime Coste 2023-09-19 17:11:33 +10:00
parent 01fd6552af
commit 871631bb00
1 changed files with 4 additions and 2 deletions

View File

@ -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