summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--scintilla/lexers/LexInno.cxx11
-rw-r--r--scintilla/lexers/LexPython.cxx14
-rw-r--r--scintilla/src/Document.cxx11
-rw-r--r--scintilla/src/Document.h12
-rw-r--r--scintilla/win32/PlatWin.cxx3
5 files changed, 33 insertions, 18 deletions
diff --git a/scintilla/lexers/LexInno.cxx b/scintilla/lexers/LexInno.cxx
index 704d4da..117160d 100644
--- a/scintilla/lexers/LexInno.cxx
+++ b/scintilla/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) {
diff --git a/scintilla/lexers/LexPython.cxx b/scintilla/lexers/LexPython.cxx
index 2ce8146..cedf7d6 100644
--- a/scintilla/lexers/LexPython.cxx
+++ b/scintilla/lexers/LexPython.cxx
@@ -28,7 +28,7 @@ using namespace Scintilla;
#endif
/* kwCDef, kwCTypeName only used for Cython */
-enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName };
+enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName, kwCPDef };
static const int indicatorWhitespace = 1;
@@ -246,7 +246,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
style = SCE_P_CLASSNAME;
} else if (kwLast == kwDef) {
style = SCE_P_DEFNAME;
- } else if (kwLast == kwCDef) {
+ } else if (kwLast == kwCDef || kwLast == kwCPDef) {
int pos = sc.currentPos;
unsigned char ch = styler.SafeGetCharAt(pos, '\0');
while (ch != '\0') {
@@ -277,11 +277,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
kwLast = kwImport;
else if (0 == strcmp(s, "cdef"))
kwLast = kwCDef;
+ else if (0 == strcmp(s, "cpdef"))
+ kwLast = kwCPDef;
else if (0 == strcmp(s, "cimport"))
kwLast = kwImport;
- else if (kwLast != kwCDef)
+ else if (kwLast != kwCDef && kwLast != kwCPDef)
kwLast = kwOther;
- } else if (kwLast != kwCDef) {
+ } else if (kwLast != kwCDef && kwLast != kwCPDef) {
kwLast = kwOther;
}
}
@@ -337,8 +339,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
indentGood = true;
}
- // One cdef line, clear kwLast only at end of line
- if (kwLast == kwCDef && sc.atLineEnd) {
+ // One cdef or cpdef line, clear kwLast only at end of line
+ if ((kwLast == kwCDef || kwLast == kwCPDef) && sc.atLineEnd) {
kwLast = kwOther;
}
diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx
index 15d1125..e230d2b 100644
--- a/scintilla/src/Document.cxx
+++ b/scintilla/src/Document.cxx
@@ -399,14 +399,15 @@ void Document::GetHighlightDelimiters(int line, HighlightDelimiter &highlightDel
}
} else if (!(lineLookLevel & SC_FOLDLEVELWHITEFLAG)) {
endOfTailOfWhiteFlag = lineLook - 1;
- if (lineLookLevel & SC_FOLDLEVELHEADERFLAG) {
+ levelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK;
+ if (lineLookLevel & SC_FOLDLEVELHEADERFLAG &&
+ //Managed the folding block when a fold header does not have any subordinate lines to fold away.
+ (levelNumber < (GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK))) {
beginFoldBlockFound = true;
beginFoldBlock = lineLook;
beginMarginCorrectlyDrawnZoneFound = true;
beginMarginCorrectlyDrawnZone = endOfTailOfWhiteFlag;
levelNumber = GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK;;
- } else {
- levelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK;
}
}
}
@@ -434,7 +435,9 @@ void Document::GetHighlightDelimiters(int line, HighlightDelimiter &highlightDel
endFoldBlockFound = true;
endFoldBlock = -1;
}
- if (!endMarginCorrectlyDrawnZoneFound && (lineLookLevel & SC_FOLDLEVELHEADERFLAG)) {
+ if (!endMarginCorrectlyDrawnZoneFound && (lineLookLevel & SC_FOLDLEVELHEADERFLAG) &&
+ //Managed the folding block when a fold header does not have any subordinate lines to fold away.
+ (levelNumber < (GetLevel(lineLook + 1) & SC_FOLDLEVELNUMBERMASK))) {
endMarginCorrectlyDrawnZoneFound = true;
endMarginCorrectlyDrawnZone = lineLook;
}
diff --git a/scintilla/src/Document.h b/scintilla/src/Document.h
index c25c0d5..2fe9020 100644
--- a/scintilla/src/Document.h
+++ b/scintilla/src/Document.h
@@ -130,7 +130,7 @@ public:
}
bool isCurrentBlockHighlight(int line) {
- return isEnabled && beginFoldBlock <= line && line <= endFoldBlock;
+ return isEnabled && beginFoldBlock != -1 && beginFoldBlock <= line && line <= endFoldBlock;
}
bool isHeadBlockFold(int line) {
@@ -138,17 +138,17 @@ public:
}
bool isBodyBlockFold(int line) {
- return beginFoldBlock < line && line < endFoldBlock;
+ return beginFoldBlock != -1 && beginFoldBlock < line && line < endFoldBlock;
}
bool isTailBlockFold(int line) {
- return beginFoldBlock < line && line == endFoldBlock;
+ return beginFoldBlock != -1 && beginFoldBlock < line && line == endFoldBlock;
}
// beginFoldBlock : Begin of current fold block.
- // endStartBlock : End of zone where margin is already drawn.
- // beginMarginCorrectlyDrawnZone : Begin of zone where margin is already drawn.
- // endMarginCorrectlyDrawnZone : End of current fold block.
+ // endStartBlock : End of current fold block.
+ // beginMarginCorrectlyDrawnZone : Begin of zone where margin is correctly drawn.
+ // endMarginCorrectlyDrawnZone : End of zone where margin is correctly drawn.
int beginFoldBlock;
int endFoldBlock;
int beginMarginCorrectlyDrawnZone;
diff --git a/scintilla/win32/PlatWin.cxx b/scintilla/win32/PlatWin.cxx
index 3c34d19..877da5d 100644
--- a/scintilla/win32/PlatWin.cxx
+++ b/scintilla/win32/PlatWin.cxx
@@ -11,6 +11,7 @@
#include <stdarg.h>
#include <stdio.h>
#include <time.h>
+#include <limits.h>
/* notepad2-mod custom code start */
#if !defined(_WIN32_WINNT)
@@ -447,7 +448,7 @@ SurfaceImpl::SurfaceImpl() :
bitmap(0), bitmapOld(0),
paletteOld(0) {
// Windows 9x has only a 16 bit coordinate system so break after 30000 pixels
- maxWidthMeasure = IsNT() ? 1000000 : 30000;
+ maxWidthMeasure = IsNT() ? INT_MAX : 30000;
// There appears to be a 16 bit string length limit in GDI on NT and a limit of
// 8192 characters on Windows 95.
maxLenText = IsNT() ? 65535 : 8192;