From 7bf090a49ac35fd92c22b6a6409d08d8b7a08554 Mon Sep 17 00:00:00 2001 From: Colomban Wendling Date: Fri, 28 Nov 2014 00:02:48 +0100 Subject: 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. --- lexers/LexCPP.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lexers') 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--; } } -- cgit v1.2.3