aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authoroirfeodent <unknown>2016-11-17 23:40:40 -0800
committeroirfeodent <unknown>2016-11-17 23:40:40 -0800
commit0e8c0541befde86fc817771282bd4ad503fe2842 (patch)
treea598ddf163146a2f02696c61bfbe41ef841c7fb5
parent4962715acd499d0651147cd6a4a81340d75eeb9a (diff)
downloadscintilla-mirror-0e8c0541befde86fc817771282bd4ad503fe2842.tar.gz
Subsection Folding breaks, when Comment placed between Main & Sub Sections. Bug Fix.
-rw-r--r--lexers/LexBaan.cxx27
1 files changed, 25 insertions, 2 deletions
diff --git a/lexers/LexBaan.cxx b/lexers/LexBaan.cxx
index 0f5953142..e94195620 100644
--- a/lexers/LexBaan.cxx
+++ b/lexers/LexBaan.cxx
@@ -258,7 +258,7 @@ static int mainOrSubSectionLine(Sci_Position line, LexAccessor &styler) {
}
static bool priorSectionIsSubSection(Sci_Position line, LexAccessor &styler){
- while (line != 0) {
+ while (line > 0) {
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
for (Sci_Position i = pos; i < eol_pos; i++) {
@@ -278,6 +278,27 @@ static bool priorSectionIsSubSection(Sci_Position line, LexAccessor &styler){
return false;
}
+static bool nextSectionIsSubSection(Sci_Position line, LexAccessor &styler) {
+ while (line > 0) {
+ Sci_Position pos = styler.LineStart(line);
+ Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
+ for (Sci_Position i = pos; i < eol_pos; i++) {
+ char ch = styler[i];
+ int style = styler.StyleAt(i);
+ if (style == SCE_BAAN_WORD4)
+ return true;
+ else if (style == SCE_BAAN_WORD5)
+ return false;
+ else if (IsASpaceOrTab(ch))
+ continue;
+ else
+ break;
+ }
+ line++;
+ }
+ return false;
+}
+
static bool IsDeclarationLine(Sci_Position line, LexAccessor &styler) {
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
@@ -889,7 +910,9 @@ void SCI_METHOD LexerBaan::Fold(Sci_PositionU startPos, Sci_Position length, int
if (!afterFunctionSection)
levelCurrent++;
}
- else if (nextLineStyle != 0 && currLineStyle != nextLineStyle) {
+ else if (nextLineStyle != 0 && currLineStyle != nextLineStyle
+ && (priorSectionIsSubSection(lineCurrent -1 ,styler)
+ || !nextSectionIsSubSection(lineCurrent + 1, styler))) {
for (Sci_Position j = styler.LineStart(lineCurrent + 1); j < styler.LineStart(lineCurrent + 1 + 1) - 1; j++) {
if (IsASpaceOrTab(styler[j]))
continue;