Pass selected completion text to InsertCompletionHide

This commit is contained in:
Maxime Coste 2019-04-16 15:55:51 +02:00
parent 0bff4851d9
commit ace499ecb1
2 changed files with 5 additions and 3 deletions

View File

@ -169,8 +169,9 @@ name. Hooks with no description will always use an empty string.
*InsertCompletionShow*::
Triggered when the insert completion menu gets displayed
*InsertCompletionHide*::
Triggered when the insert completion menu gets hidden
*InsertCompletionHide* `completion`::
Triggered when the insert completion menu gets hidden, the inserted
completion text is passed as filtering text.
*InsertCompletionSelect* `selected completion`::
Triggered when an entry is selected in the insert completion

View File

@ -473,13 +473,14 @@ void InsertCompleter::reset()
{
if (m_explicit_completer or m_completions.is_valid())
{
String selected_item = std::move(m_completions.candidates[m_current_candidate].completion);
m_explicit_completer = nullptr;
m_completions = InsertCompletion{};
if (m_context.has_client())
{
m_context.client().menu_hide();
m_context.client().info_hide();
m_context.hooks().run_hook(Hook::InsertCompletionHide, "", m_context);
m_context.hooks().run_hook(Hook::InsertCompletionHide, selected_item, m_context);
}
}
}