summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMaxime Coste <mawww@kakoune.org>2021-01-22 17:18:02 +1100
committerMaxime Coste <mawww@kakoune.org>2021-01-22 17:21:59 +1100
commit04a64e6e29798f61005a898f720d0a50decfe45b (patch)
tree006679de783706de0213c43a11150785fe81594c /src
parent0fd5a9d995d5f8c310f203272a1a9296f17fb486 (diff)
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.
Diffstat (limited to 'src')
-rw-r--r--src/highlighters.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/highlighters.cc b/src/highlighters.cc
index 47278cd0..c3b996a8 100644
--- a/src/highlighters.cc
+++ b/src/highlighters.cc
@@ -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;
}