insert-after-char should insert-before-char if char is EOL marker

This commit is contained in:
Josh Holtrop 2016-10-15 18:40:36 -04:00
parent 7557fc4c1e
commit c6a8d1597e

View File

@ -342,7 +342,7 @@ void PieceTable::begin_insert(const Cursor & cursor, bool before)
{
Piece * piece = cursor.iterator.piece;
uint32_t offset = cursor.iterator.offset;
if (!before && cursor.iterator.has_char())
if (!before && cursor.iterator.has_char() && (*cursor != INTERNAL_EOL))
{
offset += cursor.iterator.num_bytes_in_code_point();
}