mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-22 05:14:41 +02:00
[BUG_FIXED] (Author: Andreas Jonsson) Disable tag matching inside PHP code blocks.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1123 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
4105c3d2fa
commit
1eba16d3a2
@ -593,6 +593,25 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr)
|
||||
if (lang != L_XML && lang != L_HTML && lang != L_PHP && lang != L_ASP && lang != L_JSP)
|
||||
return;
|
||||
|
||||
// If we're inside a code block (i.e not markup), don't try to match tags.
|
||||
if (lang == L_PHP || lang == L_ASP || lang == L_JSP)
|
||||
{
|
||||
std::string codeBeginTag = lang == L_PHP ? "<?" : "<%";
|
||||
std::string codeEndTag = lang == L_PHP ? "?>" : "%>";
|
||||
|
||||
const int caret = 1 + _pEditView->execute(SCI_GETCURRENTPOS); // +1 to deal with the case when the caret is between the angle and the question mark in "<?" (or between '<' and '%').
|
||||
const FindResult startFound = findText(codeBeginTag.c_str(), caret, 0, 0); // This searches backwards from "caret".
|
||||
const FindResult endFound= findText(codeEndTag.c_str(), caret, 0, 0); // This searches backwards from "caret".
|
||||
|
||||
if(startFound.success)
|
||||
{
|
||||
if(! endFound.success)
|
||||
return;
|
||||
else if(endFound.success && endFound.start <= startFound.end)
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// Get the original targets and search options to restore after tag matching operation
|
||||
int originalStartPos = _pEditView->execute(SCI_GETTARGETSTART);
|
||||
int originalEndPos = _pEditView->execute(SCI_GETTARGETEND);
|
||||
|
Loading…
x
Reference in New Issue
Block a user