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();