diff --git a/doc/pages/hooks.asciidoc b/doc/pages/hooks.asciidoc index 8baba215..21e71d3d 100644 --- a/doc/pages/hooks.asciidoc +++ b/doc/pages/hooks.asciidoc @@ -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 diff --git a/src/insert_completer.cc b/src/insert_completer.cc index 69641085..2c8479a6 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -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); } } }