From ac118c60826a10f3018e2c3c889bbafa9c72078f Mon Sep 17 00:00:00 2001 From: Don Ho Date: Sun, 6 Dec 2009 03:59:01 +0000 Subject: [PATCH] [BUG_FIXED] Fix tag highlighting bug while disabling indent guide lines. git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@586 f5eea248-9336-0410-98b8-ebc06183d4e3 --- PowerEditor/src/Notepad_plus.cpp | 82 ------------------- .../xmlMatchedTagsHighlighter.cpp | 19 +++-- 2 files changed, 11 insertions(+), 90 deletions(-) diff --git a/PowerEditor/src/Notepad_plus.cpp b/PowerEditor/src/Notepad_plus.cpp index 0c9e263c7..c244a1caa 100644 --- a/PowerEditor/src/Notepad_plus.cpp +++ b/PowerEditor/src/Notepad_plus.cpp @@ -2803,88 +2803,6 @@ BOOL Notepad_plus::notify(SCNotification *notification) break; } -/* - case SCN_UPDATEUI: - { - - NppParameters *nppParam = NppParameters::getInstance(); - - // if it's searching/replacing, then do nothing - if (nppParam->_isFindReplacing) - break; - - if (notification->nmhdr.hwndFrom != _pEditView->getHSelf()) - break; - - static NppGUI & nppGui = (NppGUI &)nppParam->getNppGUI(); - static StyleArray & stylers = nppParam->getMiscStylerArray(); - static int iBraceStyle = stylers.getStylerIndexByID(STYLE_BRACELIGHT); - if (iBraceStyle != -1) - { - Style *pBraceStyle = &(stylers.getStyler(iBraceStyle)); - _pEditView->execute(SCI_STYLESETFORE, STYLE_BRACELIGHT, pBraceStyle->_fgColor); - } - - if (braceMatch()) - { - _pEditView->clearIndicator(SCE_UNIVERSAL_TAGMATCH); - _pEditView->clearIndicator(SCE_UNIVERSAL_TAGATTR); - } - else - { - if (nppGui._enableTagsMatchHilite) - { - XmlMatchedTagsHighlighter xmlTagMatchHiliter(_pEditView); - pair tagPos = xmlTagMatchHiliter.tagMatch(nppGui._enableTagAttrsHilite); - - - int braceAtCaret = tagPos.first; - int braceOpposite = tagPos.second; - - if ((braceAtCaret != -1) && (braceOpposite == -1)) - { - _pEditView->execute(SCI_SETHIGHLIGHTGUIDE, 0); - } - - else if (_pEditView->isShownIndentGuide()) - { - int columnAtCaret = int(_pEditView->execute(SCI_GETCOLUMN, braceAtCaret)); - int columnOpposite = int(_pEditView->execute(SCI_GETCOLUMN, braceOpposite)); - - int lineAtCaret = int(_pEditView->execute(SCI_LINEFROMPOSITION, braceAtCaret)); - int lineOpposite = int(_pEditView->execute(SCI_LINEFROMPOSITION, braceOpposite)); - if (lineAtCaret != lineOpposite) - { - static int iTagMatchStyle = stylers.getStylerIndexByID(SCE_UNIVERSAL_TAGMATCH); - if (iTagMatchStyle != -1) - { - Style *pTagStyle = &(stylers.getStyler(iTagMatchStyle)); - _pEditView->execute(SCI_STYLESETFORE, STYLE_BRACELIGHT, pTagStyle->_bgColor); - } - // braceAtCaret - 1, braceOpposite-1 : walk around to not highlight the '<' - _pEditView->execute(SCI_BRACEHIGHLIGHT, braceAtCaret-1, braceOpposite-1); - _pEditView->execute(SCI_SETHIGHLIGHTGUIDE, (columnAtCaret < columnOpposite)?columnAtCaret:columnOpposite); - } - } - - } - } - - - if (nppGui._enableSmartHilite) - { - if (nppGui._disableSmartHiliteTmp) - nppGui._disableSmartHiliteTmp = false; - else - _smartHighlighter.highlightView(notifyView); - } - updateStatusBar(); - AutoCompletion * autoC = isFromPrimary?&_autoCompleteMain:&_autoCompleteSub; - autoC->update(0); - break; - } -*/ - case SCN_SCROLLED: { const NppGUI & nppGUI = (NppParameters::getInstance())->getNppGUI(); diff --git a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp index df651115e..2eddd53ff 100644 --- a/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/xmlMatchedTagsHighlighter.cpp @@ -489,16 +489,19 @@ void XmlMatchedTagsHighlighter::tagMatch(bool doHiliteAttr) } // Colouising indent guide line position - int columnAtCaret = int(_pEditView->execute(SCI_GETCOLUMN, xmlTags.tagOpenStart)); - int columnOpposite = int(_pEditView->execute(SCI_GETCOLUMN, xmlTags.tagCloseStart)); + if (_pEditView->isShownIndentGuide()) + { + int columnAtCaret = int(_pEditView->execute(SCI_GETCOLUMN, xmlTags.tagOpenStart)); + int columnOpposite = int(_pEditView->execute(SCI_GETCOLUMN, xmlTags.tagCloseStart)); - int lineAtCaret = int(_pEditView->execute(SCI_LINEFROMPOSITION, xmlTags.tagOpenStart)); - int lineOpposite = int(_pEditView->execute(SCI_LINEFROMPOSITION, xmlTags.tagCloseStart)); + int lineAtCaret = int(_pEditView->execute(SCI_LINEFROMPOSITION, xmlTags.tagOpenStart)); + int lineOpposite = int(_pEditView->execute(SCI_LINEFROMPOSITION, xmlTags.tagCloseStart)); - if (xmlTags.tagCloseStart != -1 && lineAtCaret != lineOpposite) - { - _pEditView->execute(SCI_BRACEHIGHLIGHT, xmlTags.tagOpenStart, xmlTags.tagCloseEnd-1); - _pEditView->execute(SCI_SETHIGHLIGHTGUIDE, (columnAtCaret < columnOpposite)?columnAtCaret:columnOpposite); + if (xmlTags.tagCloseStart != -1 && lineAtCaret != lineOpposite) + { + _pEditView->execute(SCI_BRACEHIGHLIGHT, xmlTags.tagOpenStart, xmlTags.tagCloseEnd-1); + _pEditView->execute(SCI_SETHIGHLIGHTGUIDE, (columnAtCaret < columnOpposite)?columnAtCaret:columnOpposite); + } } }