Small refactor in highlighters.cc
This commit is contained in:
parent
4d6b8a70e1
commit
09fc14be4b
|
@ -745,16 +745,15 @@ void update_matches(const Buffer& buffer, ArrayView<LineModification> modifs,
|
|||
[](const LineCount& l, const LineModification& c)
|
||||
{ return l < c.old_line; });
|
||||
|
||||
bool erase = false;
|
||||
if (modif_it != modifs.begin())
|
||||
{
|
||||
auto& prev = *(modif_it-1);
|
||||
erase = it->line < prev.old_line + prev.num_removed;
|
||||
if (it->line < prev.old_line + prev.num_removed)
|
||||
continue; // match removed
|
||||
|
||||
it->line += prev.diff();
|
||||
}
|
||||
|
||||
if (not erase)
|
||||
{
|
||||
it->timestamp = buf_timestamp;
|
||||
kak_assert(buffer.is_valid(it->begin_coord()) or
|
||||
buffer[it->line].length() == it->begin);
|
||||
|
@ -765,7 +764,6 @@ void update_matches(const Buffer& buffer, ArrayView<LineModification> modifs,
|
|||
*ins_pos = std::move(*it);
|
||||
++ins_pos;
|
||||
}
|
||||
}
|
||||
matches.erase(ins_pos, matches.end());
|
||||
size_t pivot = matches.size();
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user