Fix Buffer::Iterator::go_previous_line()

This commit is contained in:
josh committed 2016-12-24 14:41:25 -05:00
1 parent 3c73b9ae97
commit 1862d867f6
3 files changed
+38 -10

No files matched your search

+8 -10
View File
@@ -153,18 +153,16 @@ bool Buffer::Iterator::go_right_in_line(bool allow_eol)
bool Buffer::Iterator::go_previous_line()
{
Iterator i2 = *this;
i2.go_back();
while (i2.valid() && (*i2 != '\n'))
while (i2.valid())
{
i2.go_back();
}
i2.go_back();
if (i2.valid())
{
m_line--;
m_offset = i2.m_offset;
go_start_of_line();
return true;
if (*i2 == '\n')
{
i2.go_start_of_line();
m_line--;
m_offset = i2.m_offset;
return true;
}
}
return false;
}