aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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) {