From c28a61187b18df5a7835ae99aba30c42b70a5471 Mon Sep 17 00:00:00 2001 From: Maxime Coste Date: Thu, 5 Jun 2014 19:41:31 +0100 Subject: [PATCH] Fix handling of empty insert --- src/selection.cc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/selection.cc b/src/selection.cc index 22f40f25..95b4e344 100644 --- a/src/selection.cc +++ b/src/selection.cc @@ -483,6 +483,13 @@ void SelectionList::insert(memoryview strings, InsertMode mode) changes_tracker.update(*m_buffer, m_timestamp); const String& str = strings[std::min(index, strings.size()-1)]; + if (str.empty()) + { + if (mode == InsertMode::Replace) + sel.anchor() = sel.cursor() = pos.coord(); + continue; + } + pos = m_buffer->insert(pos, str); auto& change = m_buffer->changes_since(m_timestamp).back();