diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 13bcfc3c6..1421004dd 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2221,6 +2221,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) XmlMatchedTagsHighlighter xmlTagMatchHiliter(_pEditView); xmlTagMatchHiliter.tagMatch(nppGUI._enableTagAttrsHilite); } + markSelectedText(); updateStatusBar(); AutoCompletion * autoC = isFromPrimary?&_autoCompleteMain:&_autoCompleteSub; diff --git a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp index 5744f0480..cbf1a2031 100644 --- a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp @@ -110,6 +110,11 @@ bool XmlMatchedTagsHighlighter::getMatchedTagPos(int searchStart, int searchEnd, bool direction = searchEnd > searchStart; + if ((direction == search2Left) && (searchStart <= searchEnd)) + return false; + else if ((direction == search2Right) && (searchStart >= searchEnd)) + return false; + pair foundPos; int ltPosOnR = getFirstTokenPosFrom(searchStart, searchEnd, tag2find, foundPos); if (ltPosOnR == -1) @@ -119,7 +124,7 @@ bool XmlMatchedTagsHighlighter::getMatchedTagPos(int searchStart, int searchEnd, int idStyle = _pEditView->execute(SCI_GETSTYLEAT, ltPosOnR); if (idStyle >= SCE_HJ_START) { - int start = foundPos.first; + int start = (direction == search2Left)?foundPos.first:foundPos.second; int end = searchEnd; return getMatchedTagPos(start, end, tag2find, oppositeTag2find, oppositeTagFound, tagsPos); }