add Buffer::Iterator::warp_to_offset()
This commit is contained in:
parent
904ac01a1c
commit
6108d09e8d
@ -180,3 +180,24 @@ bool Buffer::Iterator::go_next_line()
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Buffer::Iterator::warp_to_offset(size_t offset)
|
||||||
|
{
|
||||||
|
Iterator i = m_buffer->begin();
|
||||||
|
m_offset = i.m_offset;
|
||||||
|
m_line = i.m_line;
|
||||||
|
for (;;)
|
||||||
|
{
|
||||||
|
i.go_forward();
|
||||||
|
if (i.m_offset > offset)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
m_offset = i.m_offset;
|
||||||
|
m_line = i.m_line;
|
||||||
|
if (!i.valid())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -46,6 +46,7 @@ public:
|
|||||||
m_offset += offset_offset;
|
m_offset += offset_offset;
|
||||||
m_line += line_offset;
|
m_line += line_offset;
|
||||||
}
|
}
|
||||||
|
void warp_to_offset(size_t offset);
|
||||||
uint8_t * address() const
|
uint8_t * address() const
|
||||||
{
|
{
|
||||||
return m_buffer->address(m_offset);
|
return m_buffer->address(m_offset);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user