summaryrefslogtreecommitdiff
path: root/src/insert_completer.cc
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2020-08-18 20:35:48 +1000
committerMaxime Coste <mawww@kakoune.org>2020-08-18 20:35:48 +1000
commit1020438462ea42f886c1ab03efe54a81cc407fd2 (patch)
tree12c1e85c38d6f09c33fa487aa497ab1149d2bec3 /src/insert_completer.cc
parent4e4a65e9440cdf7164b7a73bdff50b6c641ac2f5 (diff)
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
Diffstat (limited to 'src/insert_completer.cc')
-rw-r--r--src/insert_completer.cc2
1 files changed, 2 insertions, 0 deletions
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)