diff options
-rw-r--r-- | scintilla/src/Document.cxx | 28 | ||||
-rw-r--r-- | scintilla/src/Document.h | 2 | ||||
-rw-r--r-- | scintilla/src/Editor.cxx | 27 | ||||
-rw-r--r-- | scintilla/src/LineMarker.cxx | 4 |
4 files changed, 44 insertions, 17 deletions
diff --git a/scintilla/src/Document.cxx b/scintilla/src/Document.cxx index e230d2b..6c60422 100644 --- a/scintilla/src/Document.cxx +++ b/scintilla/src/Document.cxx @@ -355,16 +355,18 @@ int Document::GetFoldParent(int line) { }
}
-void Document::GetHighlightDelimiters(int line, HighlightDelimiter &highlightDelimiter) {
+void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, int line, int topLine, int bottomLine) {
+ int noNeedToParseBefore = Platform::Minimum(line, topLine) - 1;
+ int noNeedToParseAfter = Platform::Maximum(line, bottomLine) + 1;
int endLine = LineFromPosition(Length());
- int beginFoldBlock = -1;
+ int beginFoldBlock = noNeedToParseBefore;
int endFoldBlock = -1;
- int beginMarginCorrectlyDrawnZone = -1;
- int endMarginCorrectlyDrawnZone = endLine + 1;
+ int beginMarginCorrectlyDrawnZone = noNeedToParseBefore;
+ int endMarginCorrectlyDrawnZone = noNeedToParseAfter;
int endOfTailOfWhiteFlag = -1; //endOfTailOfWhiteFlag points the last SC_FOLDLEVELWHITEFLAG if follow a fold block. Otherwise endOfTailOfWhiteFlag points end of fold block.
int level = GetLevel(line);
int levelNumber = -1;
- int lineLookLevel = -1;
+ int lineLookLevel = 0;
int lineLookLevelNumber = -1;
int lineLook = line;
bool beginFoldBlockFound = false;
@@ -375,7 +377,7 @@ void Document::GetHighlightDelimiters(int line, HighlightDelimiter &highlightDel /*******************************************************************************/
/* search backward (beginFoldBlock & beginMarginCorrectlyDrawnZone) */
/*******************************************************************************/
- for (endOfTailOfWhiteFlag = line; lineLook >= 0 && (!beginFoldBlockFound || !beginMarginCorrectlyDrawnZoneFound); --lineLook) {
+ for (endOfTailOfWhiteFlag = line; (lineLook > noNeedToParseBefore || (lineLookLevel & SC_FOLDLEVELWHITEFLAG)) && (!beginFoldBlockFound || !beginMarginCorrectlyDrawnZoneFound); --lineLook) {
lineLookLevel = GetLevel(lineLook);
if (levelNumber != -1) {
lineLookLevelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK;
@@ -395,7 +397,8 @@ void Document::GetHighlightDelimiters(int line, HighlightDelimiter &highlightDel beginMarginCorrectlyDrawnZone = lineLook - 1;
}
} else if (!beginFoldBlockFound && lineLookLevelNumber == SC_FOLDLEVELBASE) {
- beginFoldBlockFound = true; //beginFoldBlock already set to -1.
+ beginFoldBlockFound = true;
+ beginFoldBlock = -1;
}
} else if (!(lineLookLevel & SC_FOLDLEVELWHITEFLAG)) {
endOfTailOfWhiteFlag = lineLook - 1;
@@ -421,7 +424,7 @@ void Document::GetHighlightDelimiters(int line, HighlightDelimiter &highlightDel } else {
lineLook = line;
}
- for (; lineLook <= endLine && (!endFoldBlockFound || !endMarginCorrectlyDrawnZoneFound); ++lineLook) {
+ for (; lineLook < noNeedToParseAfter && (!endFoldBlockFound || !endMarginCorrectlyDrawnZoneFound); ++lineLook) {
lineLookLevel = GetLevel(lineLook);
lineLookLevelNumber = lineLookLevel & SC_FOLDLEVELNUMBERMASK;
if (!endFoldBlockFound && !(lineLookLevel & SC_FOLDLEVELWHITEFLAG) && lineLookLevelNumber < levelNumber) {
@@ -2051,6 +2054,12 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s // the start position is at end of line or between line end characters.
lineRangeStart++;
startPos = doc->LineStart(lineRangeStart);
+ } else if ((increment == -1) &&
+ (startPos <= doc->LineStart(lineRangeStart)) &&
+ (lineRangeStart > lineRangeEnd)) {
+ // the start position is at beginning of line.
+ lineRangeStart--;
+ startPos = doc->LineEnd(lineRangeStart);
}
int pos = -1;
int lenRet = 0;
@@ -2088,7 +2097,8 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s if (success) {
pos = search.bopat[0];
lenRet = search.eopat[0] - search.bopat[0];
- if (increment == -1) {
+ // There can be only one start of a line, so no need to look for last match in line
+ if ((increment == -1) && (s[0] != '^')) {
// Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop
while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) {
diff --git a/scintilla/src/Document.h b/scintilla/src/Document.h index 2fe9020..9f40aea 100644 --- a/scintilla/src/Document.h +++ b/scintilla/src/Document.h @@ -340,7 +340,7 @@ public: void ClearLevels();
int GetLastChild(int lineParent, int level=-1);
int GetFoldParent(int line);
- void GetHighlightDelimiters(int line, HighlightDelimiter &hDelimiter);
+ void GetHighlightDelimiters(HighlightDelimiter &hDelimiter, int line, int topLine, int bottomLine);
void Indent(bool forwards);
int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false);
diff --git a/scintilla/src/Editor.cxx b/scintilla/src/Editor.cxx index e2d7d31..95fb7cf 100644 --- a/scintilla/src/Editor.cxx +++ b/scintilla/src/Editor.cxx @@ -1730,7 +1730,9 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { }
}
if (highlightDelimiter.isEnabled && (vs.ms[margin].mask & SC_MASK_FOLDERS)) {
- pdoc->GetHighlightDelimiters(pdoc->LineFromPosition(CurrentPosition()), highlightDelimiter);
+ int lineBack = cs.DocFromDisplay(topLine);
+ int lineFront = cs.DocFromDisplay(((rcMargin.bottom - rcMargin.top) / vs.lineHeight) + topLine) + 1;
+ pdoc->GetHighlightDelimiters(highlightDelimiter, pdoc->LineFromPosition(CurrentPosition()), lineBack, lineFront);
}
// Old code does not know about new markers needed to distinguish all cases
@@ -1745,6 +1747,7 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { int lineDoc = cs.DocFromDisplay(visibleLine);
PLATFORM_ASSERT(cs.GetVisible(lineDoc));
bool firstSubLine = visibleLine == cs.DisplayFromDoc(lineDoc);
+ bool lastSubLine = visibleLine == (cs.DisplayFromDoc(lineDoc + 1) - 1);
// Decide which fold indicator should be displayed
level = pdoc->GetLevel(lineDoc);
@@ -1768,11 +1771,19 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { else
marks |= 1 << folderEnd;
}
- } else if (levelNum > SC_FOLDLEVELBASE){
+ } else if (levelNum > SC_FOLDLEVELBASE) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
} else {
- marks |= 1 << SC_MARKNUM_FOLDERSUB;
+ if (levelNum < levelNextNum) {
+ if (cs.GetExpanded(lineDoc)) {
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
+ } else if (levelNum > SC_FOLDLEVELBASE) {
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
+ }
+ } else if (levelNum > SC_FOLDLEVELBASE) {
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
+ }
}
needWhiteClosure = false;
} else if (level & SC_FOLDLEVELWHITEFLAG) {
@@ -1803,10 +1814,14 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) { if (levelNext & SC_FOLDLEVELWHITEFLAG) {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
needWhiteClosure = true;
- } else if (levelNextNum > SC_FOLDLEVELBASE) {
- marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+ } else if (lastSubLine) {
+ if (levelNextNum > SC_FOLDLEVELBASE) {
+ marks |= 1 << SC_MARKNUM_FOLDERMIDTAIL;
+ } else {
+ marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+ }
} else {
- marks |= 1 << SC_MARKNUM_FOLDERTAIL;
+ marks |= 1 << SC_MARKNUM_FOLDERSUB;
}
} else {
marks |= 1 << SC_MARKNUM_FOLDERSUB;
diff --git a/scintilla/src/LineMarker.cxx b/scintilla/src/LineMarker.cxx index 688d139..5614c3a 100644 --- a/scintilla/src/LineMarker.cxx +++ b/scintilla/src/LineMarker.cxx @@ -77,6 +77,8 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac case LineMarker::head :
head = backSelected;
tail = backSelected;
+ if (markType == SC_MARK_VLINE)
+ body = backSelected;
break;
case LineMarker::body :
head = backSelected;
@@ -184,7 +186,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac } else if (markType == SC_MARK_VLINE) {
surface->PenColour(body.allocated);
- surface->MoveTo(centreX, rcWhole.top);
+ surface->MoveTo(centreX, rcWhole.top + blobSize - (rcWhole.bottom - rcWhole.top)/2);
surface->LineTo(centreX, rcWhole.bottom);
} else if (markType == SC_MARK_LCORNER) {
|