Rename iterator movement functions
This commit is contained in:
parent
1db3853dab
commit
9dee74d18b
@ -34,7 +34,7 @@ std::shared_ptr<GapBuffer::Cursor> GapBuffer::add_cursor()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void GapBuffer::Iterator::forward()
|
void GapBuffer::Iterator::go_forward()
|
||||||
{
|
{
|
||||||
if (valid())
|
if (valid())
|
||||||
{
|
{
|
||||||
@ -42,12 +42,12 @@ void GapBuffer::Iterator::forward()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GapBuffer::Iterator::check_forward()
|
bool GapBuffer::Iterator::check_go_forward()
|
||||||
{
|
{
|
||||||
if (valid())
|
if (valid())
|
||||||
{
|
{
|
||||||
Iterator i2 = *this;
|
Iterator i2 = *this;
|
||||||
i2.forward();
|
i2.go_forward();
|
||||||
if (i2.valid())
|
if (i2.valid())
|
||||||
{
|
{
|
||||||
m_offset = i2.m_offset;
|
m_offset = i2.m_offset;
|
||||||
@ -57,7 +57,7 @@ bool GapBuffer::Iterator::check_forward()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GapBuffer::Iterator::back()
|
void GapBuffer::Iterator::go_back()
|
||||||
{
|
{
|
||||||
if (valid())
|
if (valid())
|
||||||
{
|
{
|
||||||
@ -74,12 +74,12 @@ void GapBuffer::Iterator::back()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool GapBuffer::Iterator::check_back()
|
bool GapBuffer::Iterator::check_go_back()
|
||||||
{
|
{
|
||||||
if (valid())
|
if (valid())
|
||||||
{
|
{
|
||||||
Iterator i2 = *this;
|
Iterator i2 = *this;
|
||||||
i2.back();
|
i2.go_back();
|
||||||
if (i2.valid())
|
if (i2.valid())
|
||||||
{
|
{
|
||||||
m_offset = i2.m_offset;
|
m_offset = i2.m_offset;
|
||||||
@ -93,7 +93,7 @@ bool GapBuffer::Iterator::check_back()
|
|||||||
bool GapBuffer::Cursor::is_start_of_line()
|
bool GapBuffer::Cursor::is_start_of_line()
|
||||||
{
|
{
|
||||||
Iterator i2 = m_iterator;
|
Iterator i2 = m_iterator;
|
||||||
if (!i2.check_back())
|
if (!i2.check_go_back())
|
||||||
{
|
{
|
||||||
/* Iterator cannot go backwards so it is at beginning of buffer. */
|
/* Iterator cannot go backwards so it is at beginning of buffer. */
|
||||||
return true;
|
return true;
|
||||||
@ -107,7 +107,7 @@ bool GapBuffer::Cursor::go_start_of_line()
|
|||||||
Iterator i2 = m_iterator;
|
Iterator i2 = m_iterator;
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
i2.back();
|
i2.go_back();
|
||||||
if (i2.valid() && (*i2 != '\n'))
|
if (i2.valid() && (*i2 != '\n'))
|
||||||
{
|
{
|
||||||
moved = true;
|
moved = true;
|
||||||
@ -144,7 +144,7 @@ bool GapBuffer::Cursor::go_left()
|
|||||||
if (!is_start_of_line())
|
if (!is_start_of_line())
|
||||||
{
|
{
|
||||||
uint32_t chr = *m_iterator;
|
uint32_t chr = *m_iterator;
|
||||||
if (m_iterator.check_back())
|
if (m_iterator.check_go_back())
|
||||||
{
|
{
|
||||||
if (chr == '\t')
|
if (chr == '\t')
|
||||||
{
|
{
|
||||||
@ -165,7 +165,7 @@ bool GapBuffer::Cursor::go_right()
|
|||||||
{
|
{
|
||||||
if (!is_end_of_line())
|
if (!is_end_of_line())
|
||||||
{
|
{
|
||||||
if (m_iterator.check_forward())
|
if (m_iterator.check_go_forward())
|
||||||
{
|
{
|
||||||
uint32_t chr = *m_iterator;
|
uint32_t chr = *m_iterator;
|
||||||
if (chr == '\t')
|
if (chr == '\t')
|
||||||
|
@ -22,10 +22,10 @@ public:
|
|||||||
{
|
{
|
||||||
return m_offset < m_gap_buffer->size();
|
return m_offset < m_gap_buffer->size();
|
||||||
}
|
}
|
||||||
void forward();
|
void go_forward();
|
||||||
bool check_forward();
|
bool check_go_forward();
|
||||||
void back();
|
void go_back();
|
||||||
bool check_back();
|
bool check_go_back();
|
||||||
uint8_t * address() const
|
uint8_t * address() const
|
||||||
{
|
{
|
||||||
return m_gap_buffer->address(m_offset);
|
return m_gap_buffer->address(m_offset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user