Clear inserted_ranges after updating insert completions candidates

They were getting out-of-sync with the stored timestamp, leading
to invalid ranges being computed and crashes.

Fixes #3666
Fixes #3571
This commit is contained in:
Maxime Coste 2020-08-18 20:35:48 +10:00
parent 4e4a65e944
commit 1020438462

View File

@ -473,6 +473,7 @@ void InsertCompleter::reset()
m_explicit_completer = nullptr; m_explicit_completer = nullptr;
m_completions = InsertCompletion{}; m_completions = InsertCompletion{};
m_inserted_ranges.clear();
if (m_context.has_client()) if (m_context.has_client())
{ {
m_context.client().menu_hide(); m_context.client().menu_hide();
@ -563,6 +564,7 @@ bool InsertCompleter::try_complete(Func complete_func)
auto& sels = m_context.selections(); auto& sels = m_context.selections();
try try
{ {
m_inserted_ranges.clear();
m_completions = complete_func(sels, m_options, m_faces); m_completions = complete_func(sels, m_options, m_faces);
} }
catch (runtime_error& e) catch (runtime_error& e)