diff options
Diffstat (limited to 'src/editor.cc')
| -rw-r--r-- | src/editor.cc | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/editor.cc b/src/editor.cc index 476e5244..0f8e3a2c 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -83,7 +83,7 @@ void Editor::insert(const String& str, InsertMode mode) { BufferIterator pos = prepare_insert(*m_buffer, sel, mode); m_buffer->insert(pos, str); - if (mode == InsertMode::Replace) + if (mode == InsertMode::Replace and not pos.is_end()) { sel.first() = pos; sel.last() = str.empty() ? pos : utf8::character_start(pos + str.length() - 1); @@ -105,7 +105,7 @@ void Editor::insert(const memoryview<String>& strings, InsertMode mode) BufferIterator pos = prepare_insert(*m_buffer, sel, mode); const String& str = strings[std::min(i, strings.size()-1)]; m_buffer->insert(pos, str); - if (mode == InsertMode::Replace) + if (mode == InsertMode::Replace and not pos.is_end()) { sel.first() = pos; sel.last() = str.empty() ? pos : utf8::character_start(pos + str.length() - 1); |
