aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authornyamatongwe <devnull@localhost>2011-04-16 15:20:03 +1000
committernyamatongwe <devnull@localhost>2011-04-16 15:20:03 +1000
commit884ae7980c1f6e8a749462c3ff1b7f2f2f4d0532 (patch)
treea23fc6627719bfdd3f271ebcc2bf79afa0533fa4
parent0dd97ffe2248775107d3c031fa6c3920aa105b91 (diff)
downloadscintilla-mirror-884ae7980c1f6e8a749462c3ff1b7f2f2f4d0532.tar.gz
Bug #3283880. Highlight source code inside [CODE] section when lexing
starts in the middle. From Marko Njezic.
-rw-r--r--lexers/LexInno.cxx11
1 files changed, 10 insertions, 1 deletions
diff --git a/lexers/LexInno.cxx b/lexers/LexInno.cxx
index 3b9b32fc0..a0f5b3271 100644
--- a/lexers/LexInno.cxx
+++ b/lexers/LexInno.cxx
@@ -36,7 +36,6 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
char *buffer = new char[length];
int bufferCount = 0;
bool isBOL, isEOL, isWS, isBOLWS = 0;
- bool isCode = false;
bool isCStyleComment = false;
WordList &sectionKeywords = *keywordLists[0];
@@ -46,6 +45,10 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
WordList &pascalKeywords = *keywordLists[4];
WordList &userKeywords = *keywordLists[5];
+ int curLine = styler.GetLine(startPos);
+ int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0;
+ bool isCode = (curLineState == 1);
+
// Go through all provided text segment
// using the hand-written state machine shown below
styler.StartAt(startPos);
@@ -66,6 +69,12 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
isEOL = (ch == '\n' || ch == '\r');
isWS = (ch == ' ' || ch == '\t');
+ if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
+ // Remember the line state for future incremental lexing
+ curLine = styler.GetLine(i);
+ styler.SetLineState(curLine, (isCode ? 1 : 0));
+ }
+
switch(state) {
case SCE_INNO_DEFAULT:
if (!isCode && ch == ';' && isBOLWS) {