From 139e4d4925da55042982ea052b864f3629d28e73 Mon Sep 17 00:00:00 2001 From: jofon <70416966+jofon@users.noreply.github.com> Date: Sat, 26 Sep 2020 16:35:23 +0100 Subject: [PATCH] Fix smart-highlighting not applying to cloned view Fixed smart-highlighting not applying to cloned view while "Highlight another view" is enabled. Fix #7910, close #8905 --- PowerEditor/src/NppNotification.cpp | 3 +-- .../src/ScitillaComponent/SmartHighlighter.cpp | 14 +++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp index ba282318..b2c612e9 100644 --- a/PowerEditor/src/NppNotification.cpp +++ b/PowerEditor/src/NppNotification.cpp @@ -862,8 +862,7 @@ BOOL Notepad_plus::notify(SCNotification *notification) if (notification->nmhdr.hwndFrom != _pEditView->getHSelf()) // notification come from unfocus view - both views ae visible { //ScintillaEditView * unfocusView = isFromPrimary ? &_subEditView : &_mainEditView; - if (nppGui._smartHiliteOnAnotherView && - _pEditView->getCurrentBufferID() != notifyView->getCurrentBufferID()) + if (nppGui._smartHiliteOnAnotherView) { TCHAR selectedText[1024]; _pEditView->getGenericSelectedText(selectedText, sizeof(selectedText)/sizeof(TCHAR), false); diff --git a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp index 4e4e4c92..b9f0a6f8 100644 --- a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp +++ b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp @@ -171,11 +171,15 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, Scintil highlightViewWithWord(pHighlightView, text2FindW); - if (nppGUI._smartHiliteOnAnotherView && unfocusView && unfocusView->isVisible() - && unfocusView->getCurrentBufferID() != pHighlightView->getCurrentBufferID()) - { - // Clear marks - unfocusView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_SMART); + if (nppGUI._smartHiliteOnAnotherView && unfocusView && unfocusView->isVisible()) + { + // Clear the indicator only when the view is not a clone, or it will clear what we have already hightlighted in the pHighlightView + if (unfocusView->getCurrentBufferID() != pHighlightView->getCurrentBufferID()) + { + unfocusView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_SMART); + } + + // Hightlight the unfocused view even if it's a clone, as it might be in a different area of the document highlightViewWithWord(unfocusView, text2FindW); }