From 1020438462ea42f886c1ab03efe54a81cc407fd2 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Tue, 18 Aug 2020 20:35:48 +1000 Subject: [PATCH] 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 --- src/insert_completer.cc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/insert_completer.cc b/src/insert_completer.cc index e3173517..a93634f7 100644 --- a/src/insert_completer.cc +++ b/src/insert_completer.cc @@ -473,6 +473,7 @@ void InsertCompleter::reset() m_explicit_completer = nullptr; m_completions = InsertCompletion{}; + m_inserted_ranges.clear(); if (m_context.has_client()) { m_context.client().menu_hide(); @@ -563,6 +564,7 @@ bool InsertCompleter::try_complete(Func complete_func) auto& sels = m_context.selections(); try { + m_inserted_ranges.clear(); m_completions = complete_func(sels, m_options, m_faces); } catch (runtime_error& e)