diff options
| author | Maxime Coste <frrrwww@gmail.com> | 2013-03-13 14:26:20 +0100 |
|---|---|---|
| committer | Maxime Coste <frrrwww@gmail.com> | 2013-03-13 14:37:03 +0100 |
| commit | 0f957b374338ca5eba3bf4e7667c79a29fc6a73a (patch) | |
| tree | 069c7546b485d3ee9581f4a8a6cab2dda018a868 /src/editor.cc | |
| parent | c1db67e31a18a723f455fa0b93c09f01100fcb59 (diff) | |
Editor: fix replace at end of buffer
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); |
