Fix handling of empty insert
This commit is contained in:
parent
26f69b199e
commit
c28a61187b
|
@ -483,6 +483,13 @@ void SelectionList::insert(memoryview<String> strings, InsertMode mode)
|
||||||
changes_tracker.update(*m_buffer, m_timestamp);
|
changes_tracker.update(*m_buffer, m_timestamp);
|
||||||
|
|
||||||
const String& str = strings[std::min(index, strings.size()-1)];
|
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);
|
pos = m_buffer->insert(pos, str);
|
||||||
|
|
||||||
auto& change = m_buffer->changes_since(m_timestamp).back();
|
auto& change = m_buffer->changes_since(m_timestamp).back();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user