aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--doc/ScintillaHistory.html3
-rw-r--r--lexers/LexFortran.cxx39
2 files changed, 10 insertions, 32 deletions
diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html
index cbfa833d4..6fb9b4c8f 100644
--- a/doc/ScintillaHistory.html
+++ b/doc/ScintillaHistory.html
@@ -468,6 +468,9 @@
Added wrap mode SC_WRAP_WHITESPACE which only wraps on whitespace, not on style changes.
</li>
<li>
+ Fix crashes and other bugs in Fortran folder by removing folding of do-label constructs.
+ </li>
+ <li>
Fix bug on Windows when resizing autocompletion list with only short strings caused the list to move.
</li>
</ul>
diff --git a/lexers/LexFortran.cxx b/lexers/LexFortran.cxx
index 3410acb40..a91828289 100644
--- a/lexers/LexFortran.cxx
+++ b/lexers/LexFortran.cxx
@@ -323,10 +323,6 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
/***************************************/
int lastStart = 0;
char prevWord[32] = "";
- char Label[6] = "";
- // Variables for do label folding.
- static int doLabels[100];
- static int posLabel=-1;
/***************************************/
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
@@ -427,7 +423,8 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
}
}
} else {
- levelDeltaNext += classifyFoldPointFortran(s, prevWord, chNextNonBlank);
+ int wordLevelDelta = classifyFoldPointFortran(s, prevWord, chNextNonBlank);
+ levelDeltaNext += wordLevelDelta;
if (((strcmp(s, "else") == 0) && (nextEOL || chNextNonBlank == '!')) ||
(strcmp(prevWord, "else") == 0 && strcmp(s, "where") == 0) || strcmp(s, "elsewhere") == 0) {
if (!isPrevLine) {
@@ -453,38 +450,16 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
levelDeltaNext -= 2;
}
- // Store the do Labels into array
+ // There are multiple forms of "do" loop. The older form with a label "do 100 i=1,10" would require matching
+ // labels to ensure the folding level does not decrease too far when labels are used for other purposes.
+ // Since this is difficult, do-label constructs are not folded.
if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) {
- unsigned int k = 0;
- for (i=j; (i<j+5 && i<endPos); i++) {
- ch = styler.SafeGetCharAt(i);
- if (IsADigit(ch))
- Label[k++] = ch;
- else
- break;
- }
- Label[k] = '\0';
- posLabel ++;
- doLabels[posLabel] = atoi(Label);
+ // Remove delta for do-label
+ levelDeltaNext -= wordLevelDelta;
}
}
strcpy(prevWord, s);
}
- } else if (style == SCE_F_LABEL) {
- if(IsADigit(ch) && !IsADigit(chNext)) {
- for(j = 0; ( j < 5 ) && ( j < i-lastStart+1 ); j++) {
- ch = styler.SafeGetCharAt(lastStart + j);
- if (IsADigit(ch) && styler.StyleAt(lastStart+j) == SCE_F_LABEL)
- Label[j] = ch;
- else
- break;
- }
- Label[j] = '\0';
- while (doLabels[posLabel] == atoi(Label) && posLabel > -1) {
- levelCurrent--;
- posLabel--;
- }
- }
}
if (atEOL) {
int lev = levelCurrent;