aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Document.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'src/Document.cxx')
-rw-r--r--src/Document.cxx14
1 files changed, 6 insertions, 8 deletions
diff --git a/src/Document.cxx b/src/Document.cxx
index 4b1f76a2a..ef8bfce4d 100644
--- a/src/Document.cxx
+++ b/src/Document.cxx
@@ -2840,14 +2840,12 @@ Sci::Position Document::BraceMatch(Sci::Position position, Sci::Position /*maxRe
position = useStartPos ? startPos : NextPosition(position, direction);
while ((position >= 0) && (position < LengthNoExcept())) {
const char chAtPos = CharAt(position);
- const int styAtPos = StyleIndexAt(position);
- if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
- if (chAtPos == chBrace)
- depth++;
- if (chAtPos == chSeek)
- depth--;
- if (depth == 0)
- return position;
+ if (chAtPos == chBrace || chAtPos == chSeek) {
+ if ((position > GetEndStyled()) || (StyleIndexAt(position) == styBrace)) {
+ depth += (chAtPos == chBrace) ? 1 : -1;
+ if (depth == 0)
+ return position;
+ }
}
const Sci::Position positionBeforeMove = position;
position = NextPosition(position, direction);