diff options
author | nyamatongwe <unknown> | 2011-04-16 15:20:03 +1000 |
---|---|---|
committer | nyamatongwe <unknown> | 2011-04-16 15:20:03 +1000 |
commit | 27e0ddfbe8da0590a79463b7036f2e8f01040d23 (patch) | |
tree | 278aca83130b74dd26363426acf72ef340d04267 | |
parent | 2dcc31216c9b6a3bc8660829e6f589875527ed8f (diff) | |
download | scintilla-mirror-27e0ddfbe8da0590a79463b7036f2e8f01040d23.tar.gz |
Bug #3283880. Highlight source code inside [CODE] section when lexing
starts in the middle.
From Marko Njezic.
-rw-r--r-- | lexers/LexInno.cxx | 11 |
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 §ionKeywords = *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) { |