diff options
author | nyamatongwe <devnull@localhost> | 2001-09-12 23:16:05 +0000 |
---|---|---|
committer | nyamatongwe <devnull@localhost> | 2001-09-12 23:16:05 +0000 |
commit | 1f43915c138cff8dbb3da48a81fdccce63abb181 (patch) | |
tree | f85658e47c10fe7c3cbec41bc3c5092045fa62cb /src | |
parent | e3af2228ee7bc434ed818ec31261defee162b19c (diff) | |
download | scintilla-mirror-1f43915c138cff8dbb3da48a81fdccce63abb181.tar.gz |
Patch from Steve to make folding work with HTML scripting.
Diffstat (limited to 'src')
-rw-r--r-- | src/LexHTML.cxx | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/src/LexHTML.cxx b/src/LexHTML.cxx index 3cf2daf63..a918ebf38 100644 --- a/src/LexHTML.cxx +++ b/src/LexHTML.cxx @@ -190,7 +190,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end, unsigned int i = 0; for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) { char ch = styler[cPos]; - if (ch != '<') + if ((ch != '<') && (ch != '/')) s[i++] = static_cast<char>(tolower(ch)); } s[i] = '\0'; @@ -516,15 +516,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty case SCE_HP_TRIPLEDOUBLE: break; default : - // maybe we should check here if it's a tag and if it's SCRIPT + // closing tag of the script (it's a closing HTML tag anyway) styler.ColourTo(i - 1, StateToPrint); state = SCE_H_TAGUNKNOWN; inScriptType = eHtml; scriptLanguage = eScriptNone; clientScript = eScriptJS; i += 2; - // unfold closing script - levelCurrent--; + tagClosing = true; continue; } } @@ -708,9 +707,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (!ishtmlwordchar(ch) && !((ch == '/') && (chPrev == '<')) && ch != '[') { int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, styler); if (eClass == SCE_H_SCRIPT) { - inScriptType = eNonHtmlScript; - scriptLanguage = clientScript; - eClass = SCE_H_TAG; + if (!tagClosing) { + inScriptType = eNonHtmlScript; + scriptLanguage = clientScript; + eClass = SCE_H_TAG; + } else { + scriptLanguage = eScriptNone; + eClass = SCE_H_TAG; + } } if (ch == '>') { styler.ColourTo(i, eClass); @@ -720,12 +724,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty state = SCE_H_DEFAULT; } tagOpened = false; - if (tagClosing) + if (tagClosing) { levelCurrent--; - else + } else { levelCurrent++; + } tagClosing = false; - } else if (ch == '/' && chNext == '>') { + } else if (ch == '/' && chNext == '>') { if (eClass == SCE_H_TAGUNKNOWN) { styler.ColourTo(i + 1, SCE_H_TAGUNKNOWN); } else { |