diff options
author | nyamatongwe <devnull@localhost> | 2011-04-16 15:20:03 +1000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2011-04-16 15:20:03 +1000 |
commit | 884ae7980c1f6e8a749462c3ff1b7f2f2f4d0532 (patch) | |
tree | a23fc6627719bfdd3f271ebcc2bf79afa0533fa4 | |
parent | 0dd97ffe2248775107d3c031fa6c3920aa105b91 (diff) | |
download | scintilla-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.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) { |