aboutsummaryrefslogtreecommitdiffhomepage
path: root/lexers/LexHTML.cxx
diff options
context:
space:
mode:
authorUnknown <jakub@vrana.cz>2011-12-28 19:24:10 -0800
committerUnknown <jakub@vrana.cz>2011-12-28 19:24:10 -0800
commitbf78662da5ce4167c9ae04a076ec8163b418a653 (patch)
tree260df54efe793ac71dd4954e75d1981906a8beb8 /lexers/LexHTML.cxx
parent362f336ba283dec7b761b6e076a5e3f3c416994a (diff)
downloadscintilla-mirror-bf78662da5ce4167c9ae04a076ec8163b418a653.tar.gz
Fold only and all empty HTML tags
Diffstat (limited to 'lexers/LexHTML.cxx')
-rw-r--r--lexers/LexHTML.cxx15
1 files changed, 8 insertions, 7 deletions
diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx
index a20796387..d8d4d2e9c 100644
--- a/lexers/LexHTML.cxx
+++ b/lexers/LexHTML.cxx
@@ -261,28 +261,29 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k
static int classifyTagHTML(unsigned int start, unsigned int end,
WordList &keywords, Accessor &styler, bool &tagDontFold,
bool caseSensitive, bool isXml, bool allowScripts) {
- char s[30 + 2];
+ char withSpace[30 + 2] = " ";
+ const char *s = withSpace + 1;
// Copy after the '<'
- unsigned int i = 0;
+ unsigned int i = 1;
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
char ch = styler[cPos];
if ((ch != '<') && (ch != '/')) {
- s[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
+ withSpace[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
}
}
//The following is only a quick hack, to see if this whole thing would work
//we first need the tagname with a trailing space...
- s[i] = ' ';
- s[i+1] = '\0';
+ withSpace[i] = ' ';
+ withSpace[i+1] = '\0';
// if the current language is XML, I can fold any tag
// if the current language is HTML, I don't want to fold certain tags (input, meta, etc.)
//...to find it in the list of no-container-tags
- tagDontFold = (!isXml) && (NULL != strstr("meta link img area br hr input ", s));
+ tagDontFold = (!isXml) && (NULL != strstr(" area base basefont br col command embed frame hr img input isindex keygen link meta param source track wbr ", withSpace));
//now we can remove the trailing space
- s[i] = '\0';
+ withSpace[i] = '\0';
// No keywords -> all are known
char chAttr = SCE_H_TAGUNKNOWN;