keep cursors off newlines after applying change operations when not in insert mode

This commit is contained in:
Josh Holtrop 2017-01-15 21:44:57 -05:00
parent 3d090b0f32
commit 08529fc115

View File

@ -241,11 +241,18 @@ size_t Buffer::lines_in_data(size_t offset, size_t length)
void Buffer::post_warp_cursors()
{
for (auto cursor : m_cursors)
if (size() > 0u)
{
if ((*cursor == *m_eof_iterator) && (size() > 0u))
for (auto cursor : m_cursors)
{
cursor->go_back();
if (*cursor == *m_eof_iterator)
{
cursor->go_back();
}
if ((!insert_mode()) && (**cursor == '\n'))
{
cursor->go_left_in_line();
}
}
}
}