aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/LexCPP.cxx
diff options
context:
space:
mode:
authornyamatongwe <unknown>2000-08-03 12:22:34 +0000
committernyamatongwe <unknown>2000-08-03 12:22:34 +0000
commit01ee5832076b4be7fcbbb0bf5bdcc4f1f534698b (patch)
tree3ac72616c4d057f33da63afff3fdea4de1daafef /src/LexCPP.cxx
parent6051be089460dfaff3f18c32cf9ee849c2f0c02b (diff)
downloadscintilla-mirror-01ee5832076b4be7fcbbb0bf5bdcc4f1f534698b.tar.gz
Fixes from Philippe for preprocessor and HTML comments and one from Steve
for HTML comments.
Diffstat (limited to 'src/LexCPP.cxx')
-rw-r--r--src/LexCPP.cxx15
1 files changed, 9 insertions, 6 deletions
diff --git a/src/LexCPP.cxx b/src/LexCPP.cxx
index b77468a44..4f70e9bd3 100644
--- a/src/LexCPP.cxx
+++ b/src/LexCPP.cxx
@@ -56,7 +56,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
- int visChars = 0;
+ int visibleChars = 0;
styler.StartSegment(startPos);
bool lastWordWasUUID = false;
for (unsigned int i = startPos; i < lengthDoc; i++) {
@@ -64,6 +64,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
+ // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
+ // Avoid triggering two times on Dos/Win
// End of line
if (state == SCE_C_STRINGEOL) {
styler.ColourTo(i, state);
@@ -71,18 +73,18 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
}
if (fold) {
int lev = levelPrev;
- if (visChars == 0)
+ if (visibleChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
- if ((levelCurrent > levelPrev) && (visChars > 0))
+ if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
- visChars = 0;
levelPrev = levelCurrent;
}
+ visibleChars = 0;
}
if (!isspace(ch))
- visChars++;
+ visibleChars++;
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
@@ -115,7 +117,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
} else if (ch == '\'') {
styler.ColourTo(i-1, state);
state = SCE_C_CHARACTER;
- } else if (ch == '#') {
+ } else if (ch == '#' && visibleChars == 1) {
+ // Preprocessor commands are alone on their line
styler.ColourTo(i-1, state);
state = SCE_C_PREPROCESSOR;
// Skip whitespace between # and preprocessor word