mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-28 08:14:18 +02:00
[BUG_FIXED] Fix find/replace bug due to Tag matching feature.
Enhance the tag matching display. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@265 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
d82edbff5b
commit
608265a3ca
@ -507,6 +507,9 @@ GLOBAL_INST:
|
||||
MessageBox MB_OK "Due to the problem of compability with this version,$\nExplorer.dll is about to be deleted."
|
||||
Delete "$INSTDIR\plugins\Explorer.dll"
|
||||
|
||||
IfFileExists "$INSTDIR\plugins\FunctionList.dll" 0 +3
|
||||
MessageBox MB_OK "Due to the problem of compability with this version,$\nFunctionList.dll is about to be deleted.$\nYou can download it via menu $\"?->Get more plugins$\" if you really need it."
|
||||
Delete "$INSTDIR\plugins\FunctionList.dll"
|
||||
; detect the right of
|
||||
UserInfo::GetAccountType
|
||||
Pop $1
|
||||
|
@ -2491,6 +2491,8 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
||||
_pEditView->execute(SCI_SETWORDCHARS, 0, (LPARAM)tagNameChars);
|
||||
int startPos = _pEditView->execute(SCI_WORDSTARTPOSITION, tagsPos.tagOpenStart+1, true);
|
||||
int endPos = _pEditView->execute(SCI_WORDENDPOSITION, tagsPos.tagOpenStart+1, true);
|
||||
tagsPos.tagNameEnd = endPos;
|
||||
|
||||
_pEditView->execute(SCI_SETCHARSDEFAULT);
|
||||
char * tagName = new char[endPos-startPos+1];
|
||||
|
||||
@ -2523,7 +2525,6 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
||||
}
|
||||
caretPos = foundPos.second;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2532,10 +2533,9 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
||||
_pEditView->execute(SCI_SETWORDCHARS, 0, (LPARAM)tagNameChars);
|
||||
int startPos = _pEditView->execute(SCI_WORDSTARTPOSITION, tagsPos.tagCloseStart+2, true);
|
||||
int endPos = _pEditView->execute(SCI_WORDENDPOSITION, tagsPos.tagCloseStart+2, true);
|
||||
|
||||
_pEditView->execute(SCI_SETCHARSDEFAULT);
|
||||
|
||||
char * tagName = new char[endPos-startPos+1];
|
||||
|
||||
_pEditView->getText(tagName, startPos, endPos);
|
||||
|
||||
string openTag = "<";
|
||||
@ -2562,8 +2562,10 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
||||
int closeLtPosOnL = getFirstTokenPosFrom(caretPos, DIR_LEFT, closeTag.c_str(), tmpPos);
|
||||
|
||||
if ((closeLtPosOnL == -1) || (closeLtPosOnL < ltPosOnL))
|
||||
{
|
||||
tagsPos.tagNameEnd = ltPosOnL + 1 + (endPos - startPos);
|
||||
return true;
|
||||
|
||||
}
|
||||
caretPos = foundPos.first;
|
||||
}
|
||||
return false;
|
||||
@ -2571,6 +2573,12 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
||||
|
||||
case inSingleTag : // if in single tag
|
||||
{
|
||||
_pEditView->execute(SCI_SETWORDCHARS, 0, (LPARAM)tagNameChars);
|
||||
//int startPos = _pEditView->execute(SCI_WORDSTARTPOSITION, tagsPos.tagOpenStart+1, true);
|
||||
int endPos = _pEditView->execute(SCI_WORDENDPOSITION, tagsPos.tagOpenStart+1, true);
|
||||
tagsPos.tagNameEnd = endPos;
|
||||
_pEditView->execute(SCI_SETCHARSDEFAULT);
|
||||
|
||||
tagsPos.tagCloseStart = -1;
|
||||
tagsPos.tagCloseEnd = -1;
|
||||
return true;
|
||||
@ -2592,18 +2600,33 @@ void Notepad_plus::tagMatch()
|
||||
if (lang != L_XML && lang != L_HTML && lang != L_PHP && lang != L_ASP)
|
||||
return;
|
||||
|
||||
// Detect if it's a xml/html tag
|
||||
// if yes, Colour it!
|
||||
// Get the original targets to restore after tag matching operation
|
||||
int originalStartPos = _pEditView->execute(SCI_GETTARGETSTART);
|
||||
int originalEndPos = _pEditView->execute(SCI_GETTARGETEND);
|
||||
|
||||
// Detect if it's a xml/html tag. If yes, Colour it!
|
||||
XmlMatchedTagsPos xmlTags;
|
||||
if (getXmlMatchedTagsPos(xmlTags))
|
||||
{
|
||||
_pEditView->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_TAGMATCH);
|
||||
_pEditView->execute(SCI_INDICATORFILLRANGE, xmlTags.tagOpenStart, xmlTags.tagOpenEnd - xmlTags.tagOpenStart);
|
||||
|
||||
int openTagTailLen = 2;
|
||||
// We colourise the close tag firstly
|
||||
if ((xmlTags.tagCloseStart != -1) && (xmlTags.tagCloseEnd != -1))
|
||||
{
|
||||
_pEditView->execute(SCI_INDICATORFILLRANGE, xmlTags.tagCloseStart, xmlTags.tagCloseEnd - xmlTags.tagCloseStart);
|
||||
// tag close is present, so it's not single tag
|
||||
openTagTailLen = 1;
|
||||
}
|
||||
|
||||
// Now the open tag and its attributs
|
||||
_pEditView->execute(SCI_INDICATORFILLRANGE, xmlTags.tagOpenStart, xmlTags.tagNameEnd - xmlTags.tagOpenStart);
|
||||
_pEditView->execute(SCI_INDICATORFILLRANGE, xmlTags.tagOpenEnd - openTagTailLen, openTagTailLen);
|
||||
}
|
||||
|
||||
// restore the original targets to avoid the conflit with search/replace function
|
||||
_pEditView->execute(SCI_SETTARGETSTART, originalStartPos);
|
||||
_pEditView->execute(SCI_SETTARGETEND, originalEndPos);
|
||||
}
|
||||
|
||||
void Notepad_plus::braceMatch()
|
||||
|
@ -271,6 +271,7 @@ private:
|
||||
CharacterRange _prevSelectedRange;
|
||||
struct XmlMatchedTagsPos {
|
||||
int tagOpenStart;
|
||||
int tagNameEnd;
|
||||
int tagOpenEnd;
|
||||
|
||||
int tagCloseStart;
|
||||
|
Loading…
x
Reference in New Issue
Block a user