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) 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>(); auto& completers = m_options["completers"].get<InsertCompleterDescList>();
Vector<StringView> option_names;
for (auto& completer : completers) for (auto& completer : completers)
{ {
if (completer.mode == InsertCompleterDesc::Option) if (completer.mode == InsertCompleterDesc::Option and
option_names.emplace_back(*completer.param); *completer.param == opt.name())
} {
if (contains(option_names, opt.name())) reset();
{ setup_ifn();
reset(); break;
setup_ifn(); }
} }
} }