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
commit9a715703f3957993d96cd9ac12d316f841cfede8 (patch)
tree011be4dfbbce456bb86b8f6ea0869edc7014ce34
parent8bcb9897f400f46d94e642ae959e90cef3068c21 (diff)
downloadscintilla-mirror-9a715703f3957993d96cd9ac12d316f841cfede8.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--;
}
}