Do not change the insert completion menu when a candidate is selected

This commit is contained in:
Maxime Coste 2015-03-13 13:52:23 +00:00
parent 0ae628fde7
commit 09e2a0b6ac

View File

@ -394,17 +394,21 @@ void InsertCompleter::menu_show()
void InsertCompleter::on_option_changed(const Option& opt)
{
// Do not reset the menu if the user has selected an entry
if (not m_matching_candidates.empty() and
m_current_candidate != m_matching_candidates.size() - 1)
return;
auto& completers = m_options["completers"].get<InsertCompleterDescList>();
Vector<StringView> option_names;
for (auto& completer : completers)
{
if (completer.mode == InsertCompleterDesc::Option)
option_names.emplace_back(*completer.param);
}
if (contains(option_names, opt.name()))
if (completer.mode == InsertCompleterDesc::Option and
*completer.param == opt.name())
{
reset();
setup_ifn();
break;
}
}
}