diff options
author | nyamatongwe <devnull@localhost> | 2002-10-12 02:42:36 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2002-10-12 02:42:36 +0000 |
commit | 70d7d60ce6000cf8d78da8805f011dca6ebc65ab (patch) | |
tree | a46bd1d0e6f9386725811b41e04d12b7ae247944 /src | |
parent | 731f5cf265f665abdd011f8d3b4c218cd43d289f (diff) | |
download | scintilla-mirror-70d7d60ce6000cf8d78da8805f011dca6ebc65ab.tar.gz |
Fixed some tab timmy problems when files use line feeds as line ends.
Diffstat (limited to 'src')
-rw-r--r-- | src/LexPython.cxx | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/LexPython.cxx b/src/LexPython.cxx index bfaa08f0e..b11fb2fb1 100644 --- a/src/LexPython.cxx +++ b/src/LexPython.cxx @@ -99,7 +99,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, int lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { - startPos = styler.LineStart(lineCurrent - 1); + lineCurrent--; + startPos = styler.LineStart(lineCurrent); if (startPos == 0) initStyle = SCE_P_DEFAULT; else @@ -139,6 +140,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, } else if (whingeLevel == 4) { chFlags = (spaceFlags & wsTab) ? chBad : chGood; } + sc.SetState(sc.state); styler.SetFlags(chFlags, static_cast<char>(sc.state)); } @@ -148,7 +150,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, (sc.state == SCE_P_TRIPLEDOUBLE)) { // Perform colourisation of white space and triple quoted strings at end of each line to allow // tab marking to work inside white space and triple quoted strings - sc.ForwardSetState(sc.state); + sc.SetState(sc.state); } lineCurrent++; styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); @@ -160,6 +162,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, break; } + bool needEOLCheck = false; + // Check for a state end if (sc.state == SCE_P_OPERATOR) { kwLast = kwOther; @@ -212,8 +216,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, sc.Forward(); } else if ((sc.state == SCE_P_STRING) && (sc.ch == '\"')) { sc.ForwardSetState(SCE_P_DEFAULT); + needEOLCheck = true; } else if ((sc.state == SCE_P_CHARACTER) && (sc.ch == '\'')) { sc.ForwardSetState(SCE_P_DEFAULT); + needEOLCheck = true; } } else if (sc.state == SCE_P_TRIPLE) { if (sc.ch == '\\') { @@ -222,6 +228,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, sc.Forward(); sc.Forward(); sc.ForwardSetState(SCE_P_DEFAULT); + needEOLCheck = true; } } else if (sc.state == SCE_P_TRIPLEDOUBLE) { if (sc.ch == '\\') { @@ -230,9 +237,18 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, sc.Forward(); sc.Forward(); sc.ForwardSetState(SCE_P_DEFAULT); + needEOLCheck = true; } } + // State exit code may have moved on to end of line + if (needEOLCheck && sc.atLineEnd) { + lineCurrent++; + styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); + if (!sc.More()) + break; + } + // Check for a new state starting character if (sc.state == SCE_P_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { |