summaryrefslogtreecommitdiff
path: root/src/input_handler.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/input_handler.cc')
-rw-r--r--src/input_handler.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/input_handler.cc b/src/input_handler.cc
index d76d3b14..fd2be75c 100644
--- a/src/input_handler.cc
+++ b/src/input_handler.cc
@@ -610,11 +610,13 @@ public:
for (auto& sel : m_context.editor().selections())
{
auto offset = buffer.offset(sel.last());
+ auto pos = buffer.iterator_at(sel.last());
if (offset >= beg_offset and offset + end_offset < buffer_len and
- std::equal(sel.last() - beg_offset, sel.last(), begin))
+ std::equal(pos - beg_offset, pos, begin))
{
- buffer.erase(sel.last() - beg_offset, sel.last() + end_offset);
- buffer.insert(sel.last(), candidate);
+ auto beg = pos - beg_offset;
+ buffer.erase(beg, pos + end_offset);
+ buffer.insert(beg, candidate);
}
}