diff --git a/src/line_modification.cc b/src/line_modification.cc index df2b9cbc..da3ee87f 100644 --- a/src/line_modification.cc +++ b/src/line_modification.cc @@ -73,10 +73,13 @@ Vector 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;