Fix DisplayLine::trim_front quadratic behaviour
Erasing fully trimmed display atoms one by one means we have to shift all the remaining ones every time. This is wasteful and we can just erase all the fully trimmed atom in one go. Fixes #4797
This commit is contained in:
parent
9257beac88
commit
eb0e983133
|
@ -252,12 +252,15 @@ bool DisplayLine::trim_from(ColumnCount first_col, ColumnCount front, ColumnCoun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
auto front_it = it;
|
||||||
while (front > 0 and it != end())
|
while (front > 0 and it != end())
|
||||||
{
|
{
|
||||||
front -= it->trim_begin(front);
|
front -= it->trim_begin(front);
|
||||||
|
kak_assert(it->empty() or front == 0);
|
||||||
if (it->empty())
|
if (it->empty())
|
||||||
it = m_atoms.erase(it);
|
++it;
|
||||||
}
|
}
|
||||||
|
m_atoms.erase(front_it, it);
|
||||||
|
|
||||||
it = begin();
|
it = begin();
|
||||||
for (; it != end() and col_count > 0; ++it)
|
for (; it != end() and col_count > 0; ++it)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user