From 9dcbef9e17af191c13c6b5c90ae2fc71f0be8583 Mon Sep 17 00:00:00 2001 From: Neil Date: Thu, 6 Feb 2014 08:04:20 +1100 Subject: Fix crashes and other bugs by removing folding of do-label constructs. --- doc/ScintillaHistory.html | 3 +++ lexers/LexFortran.cxx | 39 +++++++-------------------------------- 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.
  • + Fix crashes and other bugs in Fortran folder by removing folding of do-label constructs. +
  • +
  • Fix bug on Windows when resizing autocompletion list with only short strings caused the list to move.
  • 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 -1) { - levelCurrent--; - posLabel--; - } - } } if (atEOL) { int lev = levelCurrent; -- cgit v1.2.3