#1186 Folding broken in mako files

Bug
closed-fixed
Scintilla (788)
5
2011-08-03
2011-06-22
No

Folding is completely wrong in mako template files. The following patch (based on Scintilla 2.25) fixes this so that at least folding of html, javascript, etc in the file works. Mako constructs themselves are not folded, however.

Index: /Users/sdeibel/src/ide/external/scintilla/lexers/LexHTML.cxx

--- /Users/sdeibel/src/ide/external/scintilla/lexers/LexHTML.cxx (revision 24772)
+++ /Users/sdeibel/src/ide/external/scintilla/lexers/LexHTML.cxx (working copy)
@@ -763,7 +763,7 @@
}
break;
case eScriptPython:
- if (state != SCE_HP_COMMENTLINE) {
+ if (state != SCE_HP_COMMENTLINE && !isMako) {
if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) {
levelCurrent++;
} else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) {
@@ -950,8 +950,6 @@
state = SCE_HP_START;
scriptLanguage = eScriptPython;
styler.ColourTo(i, SCE_H_ASP);
- if (foldHTMLPreprocessor && ch == '<')
- levelCurrent++;

        if \(ch \!= '%' && ch \!= '$'\) \{
            i += strlen\(makoBlockType\);

@@ -1113,9 +1111,6 @@
inScriptType = eNonHtmlScript;
else
inScriptType = eHtml;
- if (foldHTMLPreprocessor && ch != '\n' && ch != '\r') {
- levelCurrent--;
- }
scriptLanguage = eScriptNone;
continue;
}

Discussion

  • Fix based on Scintilla 2.25 sources

     
    Attachments
  • Neil Hodgson
    Neil Hodgson
    2011-06-22

    OK, committed.

     
  • Neil Hodgson
    Neil Hodgson
    2011-06-22

    • assigned_to: nobody --> sdeibel
    • status: open --> open-fixed
     
  • Neil Hodgson
    Neil Hodgson
    2011-08-03

    • status: open-fixed --> closed-fixed