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
@ -506,7 +506,10 @@ GLOBAL_INST:
|
|||||||
IfFileExists "$INSTDIR\plugins\Explorer.dll" 0 +3
|
IfFileExists "$INSTDIR\plugins\Explorer.dll" 0 +3
|
||||||
MessageBox MB_OK "Due to the problem of compability with this version,$\nExplorer.dll is about to be deleted."
|
MessageBox MB_OK "Due to the problem of compability with this version,$\nExplorer.dll is about to be deleted."
|
||||||
Delete "$INSTDIR\plugins\Explorer.dll"
|
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
|
; detect the right of
|
||||||
UserInfo::GetAccountType
|
UserInfo::GetAccountType
|
||||||
Pop $1
|
Pop $1
|
||||||
@ -1068,4 +1071,4 @@ FunctionEnd
|
|||||||
|
|
||||||
BrandingText "Don HO"
|
BrandingText "Don HO"
|
||||||
|
|
||||||
; eof
|
; eof
|
||||||
|
@ -2491,6 +2491,8 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
|||||||
_pEditView->execute(SCI_SETWORDCHARS, 0, (LPARAM)tagNameChars);
|
_pEditView->execute(SCI_SETWORDCHARS, 0, (LPARAM)tagNameChars);
|
||||||
int startPos = _pEditView->execute(SCI_WORDSTARTPOSITION, tagsPos.tagOpenStart+1, true);
|
int startPos = _pEditView->execute(SCI_WORDSTARTPOSITION, tagsPos.tagOpenStart+1, true);
|
||||||
int endPos = _pEditView->execute(SCI_WORDENDPOSITION, tagsPos.tagOpenStart+1, true);
|
int endPos = _pEditView->execute(SCI_WORDENDPOSITION, tagsPos.tagOpenStart+1, true);
|
||||||
|
tagsPos.tagNameEnd = endPos;
|
||||||
|
|
||||||
_pEditView->execute(SCI_SETCHARSDEFAULT);
|
_pEditView->execute(SCI_SETCHARSDEFAULT);
|
||||||
char * tagName = new char[endPos-startPos+1];
|
char * tagName = new char[endPos-startPos+1];
|
||||||
|
|
||||||
@ -2523,7 +2525,6 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
|||||||
}
|
}
|
||||||
caretPos = foundPos.second;
|
caretPos = foundPos.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2532,10 +2533,9 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
|||||||
_pEditView->execute(SCI_SETWORDCHARS, 0, (LPARAM)tagNameChars);
|
_pEditView->execute(SCI_SETWORDCHARS, 0, (LPARAM)tagNameChars);
|
||||||
int startPos = _pEditView->execute(SCI_WORDSTARTPOSITION, tagsPos.tagCloseStart+2, true);
|
int startPos = _pEditView->execute(SCI_WORDSTARTPOSITION, tagsPos.tagCloseStart+2, true);
|
||||||
int endPos = _pEditView->execute(SCI_WORDENDPOSITION, tagsPos.tagCloseStart+2, true);
|
int endPos = _pEditView->execute(SCI_WORDENDPOSITION, tagsPos.tagCloseStart+2, true);
|
||||||
|
|
||||||
_pEditView->execute(SCI_SETCHARSDEFAULT);
|
_pEditView->execute(SCI_SETCHARSDEFAULT);
|
||||||
|
|
||||||
char * tagName = new char[endPos-startPos+1];
|
char * tagName = new char[endPos-startPos+1];
|
||||||
|
|
||||||
_pEditView->getText(tagName, startPos, endPos);
|
_pEditView->getText(tagName, startPos, endPos);
|
||||||
|
|
||||||
string openTag = "<";
|
string openTag = "<";
|
||||||
@ -2562,8 +2562,10 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
|||||||
int closeLtPosOnL = getFirstTokenPosFrom(caretPos, DIR_LEFT, closeTag.c_str(), tmpPos);
|
int closeLtPosOnL = getFirstTokenPosFrom(caretPos, DIR_LEFT, closeTag.c_str(), tmpPos);
|
||||||
|
|
||||||
if ((closeLtPosOnL == -1) || (closeLtPosOnL < ltPosOnL))
|
if ((closeLtPosOnL == -1) || (closeLtPosOnL < ltPosOnL))
|
||||||
|
{
|
||||||
|
tagsPos.tagNameEnd = ltPosOnL + 1 + (endPos - startPos);
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
caretPos = foundPos.first;
|
caretPos = foundPos.first;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
@ -2571,6 +2573,12 @@ bool Notepad_plus::getXmlMatchedTagsPos(XmlMatchedTagsPos & tagsPos)
|
|||||||
|
|
||||||
case inSingleTag : // if in single tag
|
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.tagCloseStart = -1;
|
||||||
tagsPos.tagCloseEnd = -1;
|
tagsPos.tagCloseEnd = -1;
|
||||||
return true;
|
return true;
|
||||||
@ -2592,18 +2600,33 @@ void Notepad_plus::tagMatch()
|
|||||||
if (lang != L_XML && lang != L_HTML && lang != L_PHP && lang != L_ASP)
|
if (lang != L_XML && lang != L_HTML && lang != L_PHP && lang != L_ASP)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Detect if it's a xml/html tag
|
// Get the original targets to restore after tag matching operation
|
||||||
// if yes, Colour it!
|
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;
|
XmlMatchedTagsPos xmlTags;
|
||||||
if (getXmlMatchedTagsPos(xmlTags))
|
if (getXmlMatchedTagsPos(xmlTags))
|
||||||
{
|
{
|
||||||
_pEditView->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_TAGMATCH);
|
_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))
|
if ((xmlTags.tagCloseStart != -1) && (xmlTags.tagCloseEnd != -1))
|
||||||
|
{
|
||||||
_pEditView->execute(SCI_INDICATORFILLRANGE, xmlTags.tagCloseStart, xmlTags.tagCloseEnd - xmlTags.tagCloseStart);
|
_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()
|
void Notepad_plus::braceMatch()
|
||||||
|
@ -271,6 +271,7 @@ private:
|
|||||||
CharacterRange _prevSelectedRange;
|
CharacterRange _prevSelectedRange;
|
||||||
struct XmlMatchedTagsPos {
|
struct XmlMatchedTagsPos {
|
||||||
int tagOpenStart;
|
int tagOpenStart;
|
||||||
|
int tagNameEnd;
|
||||||
int tagOpenEnd;
|
int tagOpenEnd;
|
||||||
|
|
||||||
int tagCloseStart;
|
int tagCloseStart;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user