1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-10-17 22:02:25 +00:00

Coalesce the current line into a single chunk when moving away from it.

This commit is contained in:
Andreas Kling 2018-12-04 13:38:42 +01:00
parent e02eca2a5e
commit efd5aae217
4 changed files with 20 additions and 0 deletions

View file

@ -94,3 +94,13 @@ std::tuple<size_t, size_t> Line::chunk_index_for_position(size_t position)
ASSERT(false);
return std::make_tuple(0, 0);
}
void Line::coalesce()
{
if (m_chunks.size() <= 1)
return;
auto contents = data();
m_chunks.clear();
m_chunks.push_back(Chunk{ contents });
}