aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorColomban Wendling <ban@herbesfolles.org>2014-11-28 00:02:48 +0100
committerColomban Wendling <ban@herbesfolles.org>2014-11-28 00:02:48 +0100
commit7bf090a49ac35fd92c22b6a6409d08d8b7a08554 (patch)
tree4c6723091d1dacf63ca56f8abb09b0ca556a6443
parent724b85e3ac3e3761d719d0eb46793302c46085ce (diff)
downloadscintilla-mirror-7bf090a49ac35fd92c22b6a6409d08d8b7a08554.tar.gz
LexCPP: Also fold on square brackets
This allows to fold on array literals for languages like JavaScript that use square brackets to declare array literals. This should not change much for languages that only use square brackets for array indexation as the large majority of the time the open and close brackets are placed on the same line in these cases.
-rw-r--r--lexers/LexCPP.cxx4
1 files changed, 2 insertions, 2 deletions
diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx
index 5485bf228..a78fcc003 100644
--- a/lexers/LexCPP.cxx
+++ b/lexers/LexCPP.cxx
@@ -1344,14 +1344,14 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
}
}
if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) {
- if (ch == '{') {
+ if (ch == '{' || ch == '[') {
// Measure the minimum before a '{' to allow
// folding on "} else {"
if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
- } else if (ch == '}') {
+ } else if (ch == '}' || ch == ']') {
levelNext--;
}
}