Skip attempt to auto-complete when closing XML comment

Closes #1977
This commit is contained in:
dail8859 2016-06-25 09:53:42 -04:00
parent cf4d3d2599
commit ed4143bbdf
1 changed files with 11 additions and 6 deletions

View File

@ -370,6 +370,17 @@ bool AutoCompletion::showFunctionComplete()
void AutoCompletion::getCloseTag(char *closeTag, size_t closeTagSize, size_t caretPos, bool isHTML)
{
char prev = (char)_pEditView->execute(SCI_GETCHARAT, caretPos - 2);
char prevprev = (char)_pEditView->execute(SCI_GETCHARAT, caretPos - 3);
// Closing a tag (i.e. "-->") will be ignored
if (prevprev == '-' && prev == '-')
return;
// "<toto/>" and "<toto arg="0" />" will be ignored
if (prev == '/')
return;
int flags = SCFIND_REGEXP | SCFIND_POSIX;
_pEditView->execute(SCI_SETSEARCHFLAGS, flags);
TCHAR tag2find[] = TEXT("<[^\\s>]*");
@ -407,12 +418,6 @@ void AutoCompletion::getCloseTag(char *closeTag, size_t closeTagSize, size_t car
}
}
char tagTail[2];
_pEditView->getText(tagTail, caretPos-2, caretPos-1);
if (tagTail[0] == '/') // "<toto/>" and "<toto arg="0" />" will be ignored
return;
closeTag[0] = '<';
closeTag[1] = '/';
_pEditView->getText(closeTag + 2, targetStart + 1, targetEnd);