Fix performance issue in show-matching highlighter on big buffers

Stop searching for the matching character when getting out of view
instead of going until the buffer edge.
This commit is contained in:
Maxime Coste 2021-01-22 17:18:02 +11:00
parent 0fd5a9d995
commit 04a64e6e29

View File

@ -1203,7 +1203,7 @@ void show_matching_char(HighlightContext context, DisplayBuffer& display_buffer,
{
const Codepoint opening = *match;
const Codepoint closing = *(match+1);
while (it != buffer.end())
while (it.base().coord() <= range.end)
{
if (*it == opening)
++level;
@ -1230,7 +1230,7 @@ void show_matching_char(HighlightContext context, DisplayBuffer& display_buffer,
false, apply_face(face));
break;
}
if (it == buffer.begin())
if (it.base().coord() <= range.begin)
break;
--it;
}