Skip auto-complete of <?xml> tag

Closes #1999
pull/1986/head
dail8859 9 years ago
parent e2ec03c35e
commit 9183281921

@ -368,7 +368,7 @@ bool AutoCompletion::showFunctionComplete()
return false;
}
void AutoCompletion::getCloseTag(char *closeTag, size_t closeTagSize, size_t caretPos, bool isHTML)
void AutoCompletion::getCloseTag(char *closeTag, size_t closeTagSize, size_t caretPos, LangType language)
{
char prev = (char)_pEditView->execute(SCI_GETCHARAT, caretPos - 2);
char prevprev = (char)_pEditView->execute(SCI_GETCHARAT, caretPos - 3);
@ -407,9 +407,9 @@ void AutoCompletion::getCloseTag(char *closeTag, size_t closeTagSize, size_t car
if (strncmp(tagHead, "<!--", 4) == 0) // Comments will be ignored
return;
if (isHTML) // for HTML: "br", "hr", "img", "link", "!doctype" and "meta" will be ignored
if (language == L_HTML) // for HTML: "br", "hr", "img", "link", "!doctype" and "meta" will be ignored
{
char *disallowedTags[] = { "br", "hr", "img", "link", "meta", "!doctype" };
const char *disallowedTags[] = { "br", "hr", "img", "link", "meta", "!doctype" };
size_t disallowedTagsLen = sizeof(disallowedTags) / sizeof(char *);
for (size_t i = 0; i < disallowedTagsLen; ++i)
{
@ -417,6 +417,12 @@ void AutoCompletion::getCloseTag(char *closeTag, size_t closeTagSize, size_t car
return;
}
}
else if (language == L_XML)
{
// Ignore "?xml"
if (strnicmp(tagHead + 1, "?xml", strlen("?xml")) == 0)
return;
}
closeTag[0] = '<';
closeTag[1] = '/';
@ -636,7 +642,7 @@ void AutoCompletion::insertMatchedChars(int character, const MatchedPairConf & m
{
if (matchedPairConf._doHtmlXmlTag && (_curLang == L_HTML || _curLang == L_XML))
{
getCloseTag(closeTag, tagMaxLen, caretPos, _curLang == L_HTML);
getCloseTag(closeTag, tagMaxLen, caretPos, _curLang);
if (closeTag[0] != '\0')
matchedChars = closeTag;
}

@ -92,7 +92,7 @@ public:
void insertMatchedChars(int character, const MatchedPairConf & matchedPairConf);
void update(int character);
void callTipClick(int direction);
void getCloseTag(char *closeTag, size_t closeTagLen, size_t caretPos, bool isHTML);
void getCloseTag(char *closeTag, size_t closeTagLen, size_t caretPos, LangType language);
private:
bool _funcCompletionActive;

Loading…
Cancel
Save