diff --git a/src/editor.cc b/src/editor.cc index 4dc40440..1567608e 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -178,8 +178,10 @@ void Editor::move_selections(LineCount offset, SelectMode mode) for (auto& sel : m_selections) { BufferCoord pos = sel.last().coord(); + CharCount column = utf8::distance(m_buffer->iterator_at_line_begin(pos.line), sel.last()); pos.line += offset; - BufferIterator last = utf8::finish(m_buffer->iterator_at(pos, true)); + BufferIterator last = utf8::advance(m_buffer->iterator_at_line_begin(pos.line), + m_buffer->iterator_at_line_end(pos.line), column); sel.first() = mode == SelectMode::Extend ? sel.first() : last; sel.last() = last; sel.avoid_eol();