diff options
author | nyamatongwe <devnull@localhost> | 2001-02-24 09:45:32 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2001-02-24 09:45:32 +0000 |
commit | 4e9238b38cb93534f9d83b341c6f8e250aa6ef7d (patch) | |
tree | dae43a218a8a00315480605333f40c3ecd7c52be /src/LexCPP.cxx | |
parent | 2572ed4c99a148d48980d070d7dbc0821801729f (diff) | |
download | scintilla-mirror-4e9238b38cb93534f9d83b341c6f8e250aa6ef7d.tar.gz |
Patch from Jan to allow folding multi-line C++ comments.
Diffstat (limited to 'src/LexCPP.cxx')
-rw-r--r-- | src/LexCPP.cxx | 19 |
1 files changed, 14 insertions, 5 deletions
diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx index 65fd5ff4b..aaa16d4e6 100644 --- a/src/LexCPP.cxx +++ b/src/LexCPP.cxx @@ -5,11 +5,11 @@ // Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // The License.txt file describes the conditions under which this software may be distributed. -#include <stdlib.h> -#include <string.h> -#include <ctype.h> -#include <stdio.h> -#include <stdarg.h> +#include <stdlib.h> +#include <string.h> +#include <ctype.h> +#include <stdio.h> +#include <stdarg.h> #include "Platform.h" @@ -51,6 +51,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo styler.StartAt(startPos); bool fold = styler.GetPropertyInt("fold"); + bool foldComment = styler.GetPropertyInt("fold.comment"); bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor"); int lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; @@ -117,6 +118,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo } } else if (ch == '/' && chNext == '*') { styler.ColourTo(i-1, state); + if (foldComment) + levelCurrent++; if (styler.SafeGetCharAt(i + 2) == '*' || styler.SafeGetCharAt(i + 2) == '!') // Support of Qt/Doxygen doc. style state = SCE_C_COMMENTDOC; @@ -160,6 +163,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo lastWordWasUUID = classifyWordCpp(styler.GetStartSegment(), i - 1, keywords, styler); state = SCE_C_DEFAULT; if (ch == '/' && chNext == '*') { + if (foldComment) + levelCurrent++; if (styler.SafeGetCharAt(i + 2) == '*') state = SCE_C_COMMENTDOC; else @@ -197,6 +202,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { styler.ColourTo(i, state); state = SCE_C_DEFAULT; + if(foldComment) + levelCurrent--; } } } else if (state == SCE_C_COMMENTDOC) { @@ -206,6 +213,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo (styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { styler.ColourTo(i, state); state = SCE_C_DEFAULT; + if(foldComment) + levelCurrent--; } } } else if (state == SCE_C_COMMENTLINE || state == SCE_C_COMMENTLINEDOC) { |