Add a small validation assert to catch a rare bug

This commit is contained in:
Maxime Coste 2014-09-10 13:41:32 +01:00
parent dd2bdea8dd
commit 90df4320b7

View File

@ -92,6 +92,9 @@ std::vector<LineModification> compute_line_modifications(const Buffer& buffer, s
modif.new_line + modif.num_added - change.pos;
const LineCount num_removed_from_added =
std::min(num_removed, num_added_after_pos);
kak_assert(modif.num_added >= num_removed_from_added);
modif.num_added -= num_removed_from_added;
modif.num_removed += num_removed - num_removed_from_added;