Fix highlighter update with new LineModification behaviour
This commit is contained in:
parent
d3bccfeb94
commit
4d6b8a70e1
|
@ -741,18 +741,17 @@ void update_matches(const Buffer& buffer, ArrayView<LineModification> modifs,
|
||||||
auto ins_pos = matches.begin();
|
auto ins_pos = matches.begin();
|
||||||
for (auto it = ins_pos; it != matches.end(); ++it)
|
for (auto it = ins_pos; it != matches.end(); ++it)
|
||||||
{
|
{
|
||||||
auto modif_it = std::lower_bound(modifs.begin(), modifs.end(), it->line,
|
auto modif_it = std::upper_bound(modifs.begin(), modifs.end(), it->line,
|
||||||
[](const LineModification& c, const LineCount& l)
|
[](const LineCount& l, const LineModification& c)
|
||||||
{ return c.old_line < l; });
|
{ return l < c.old_line; });
|
||||||
|
|
||||||
bool erase = (modif_it != modifs.end() and modif_it->old_line == it->line);
|
bool erase = false;
|
||||||
if (not erase and modif_it != modifs.begin())
|
if (modif_it != modifs.begin())
|
||||||
{
|
{
|
||||||
auto& prev = *(modif_it-1);
|
auto& prev = *(modif_it-1);
|
||||||
erase = it->line < prev.old_line + prev.num_removed;
|
erase = it->line < prev.old_line + prev.num_removed;
|
||||||
it->line += prev.diff();
|
it->line += prev.diff();
|
||||||
}
|
}
|
||||||
erase = erase or (it->line >= buffer.line_count());
|
|
||||||
|
|
||||||
if (not erase)
|
if (not erase)
|
||||||
{
|
{
|
||||||
|
@ -773,9 +772,7 @@ void update_matches(const Buffer& buffer, ArrayView<LineModification> modifs,
|
||||||
// try to find new matches in each updated lines
|
// try to find new matches in each updated lines
|
||||||
for (auto& modif : modifs)
|
for (auto& modif : modifs)
|
||||||
{
|
{
|
||||||
for (auto line = modif.new_line;
|
for (auto line = modif.new_line; line < modif.new_line + modif.num_added; ++line)
|
||||||
line < modif.new_line + modif.num_added and
|
|
||||||
line < buffer.line_count(); ++line)
|
|
||||||
{
|
{
|
||||||
auto l = buffer[line];
|
auto l = buffer[line];
|
||||||
for (RegexIterator<const char*> it{l.begin(), l.end(), regex}, end{}; it != end; ++it)
|
for (RegexIterator<const char*> it{l.begin(), l.end(), regex}, end{}; it != end; ++it)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user