1
1
mirror of https://github.com/mawww/kakoune.git synced 2024-12-28 22:22:41 +03:00

compute_line_modifications: avoid potentially long iteration

This commit is contained in:
Maxime Coste 2018-05-16 20:41:02 +10:00
parent fcce76ba57
commit 4cc9c9997e

View File

@ -73,10 +73,13 @@ Vector<LineModification> compute_line_modifications(const Buffer& buffer, size_t
}
next = res.erase(next, delend);
for (auto it = next; it != res.end(); ++it)
it->new_line -= diff;
if (diff != 0)
{
for (auto it = next; it != res.end(); ++it)
it->new_line -= diff;
}
}
else
else if (diff != 0)
{
for (auto it = next; it != res.end(); ++it)
it->new_line += diff;