summaryrefslogtreecommitdiff
path: root/src/selection.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/selection.cc')
-rw-r--r--src/selection.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/selection.cc b/src/selection.cc
index d8808054..bd18bf85 100644
--- a/src/selection.cc
+++ b/src/selection.cc
@@ -446,7 +446,7 @@ BufferIterator prepare_insert(Buffer& buffer, const Selection& sel, InsertMode m
{
// special case for end of lines, append to current line instead
auto pos = buffer.iterator_at(sel.max());
- return *pos == '\n' ? pos : utf8::next(pos);
+ return *pos == '\n' ? pos : utf8::next(pos, buffer.end());
}
case InsertMode::InsertAtLineBegin:
return buffer.iterator_at(sel.min().line);