add PieceTable::get_start_of_line()
This commit is contained in:
parent
d043137099
commit
b61513b97e
@ -29,3 +29,15 @@ void PieceTable::append_initial_line_piece(uint8_t * start, uint32_t length, uin
|
|||||||
if (cursor_position.pd == end_descriptor)
|
if (cursor_position.pd == end_descriptor)
|
||||||
cursor_position.pd = pd;
|
cursor_position.pd = pd;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PieceTable::PieceDescriptor * PieceTable::get_start_of_line(PieceTable::PieceDescriptor * start) const
|
||||||
|
{
|
||||||
|
PieceDescriptor * pd = start;
|
||||||
|
|
||||||
|
while (pd->prev != start_descriptor && !pd->prev->eol())
|
||||||
|
{
|
||||||
|
pd = pd->prev;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pd;
|
||||||
|
}
|
||||||
|
@ -81,6 +81,8 @@ public:
|
|||||||
|
|
||||||
void append_initial_line_piece(uint8_t * start, uint32_t length, uint32_t n_chars, bool eol);
|
void append_initial_line_piece(uint8_t * start, uint32_t length, uint32_t n_chars, bool eol);
|
||||||
|
|
||||||
|
PieceDescriptor * get_start_of_line(PieceDescriptor * start) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
const uint8_t * m_file_buffer;
|
const uint8_t * m_file_buffer;
|
||||||
unsigned long m_file_buffer_size;
|
unsigned long m_file_buffer_size;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user