diff --git a/PowerEditor/installer/nativeLang/chinese.xml b/PowerEditor/installer/nativeLang/chinese.xml
index 2f3fd7c40..c3b064865 100644
--- a/PowerEditor/installer/nativeLang/chinese.xml
+++ b/PowerEditor/installer/nativeLang/chinese.xml
@@ -717,6 +717,7 @@
+
diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index e5628f87f..5c0a34e5d 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -715,6 +715,7 @@
+
diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml
index 5f56518e7..694caa3bb 100644
--- a/PowerEditor/installer/nativeLang/french.xml
+++ b/PowerEditor/installer/nativeLang/french.xml
@@ -700,6 +700,7 @@
+
diff --git a/PowerEditor/src/NppNotification.cpp b/PowerEditor/src/NppNotification.cpp
index 2636d90e6..c7e1147e4 100644
--- a/PowerEditor/src/NppNotification.cpp
+++ b/PowerEditor/src/NppNotification.cpp
@@ -37,15 +37,21 @@
using namespace std;
-
-
-
+// Only for 2 main Scintilla editors
BOOL Notepad_plus::notify(SCNotification *notification)
{
//Important, keep track of which element generated the message
bool isFromPrimary = (_mainEditView.getHSelf() == notification->nmhdr.hwndFrom || _mainDocTab.getHSelf() == notification->nmhdr.hwndFrom);
bool isFromSecondary = !isFromPrimary && (_subEditView.getHSelf() == notification->nmhdr.hwndFrom || _subDocTab.getHSelf() == notification->nmhdr.hwndFrom);
- ScintillaEditView * notifyView = isFromPrimary?&_mainEditView:&_subEditView;
+
+ ScintillaEditView * notifyView = nullptr;
+ if (isFromPrimary)
+ notifyView = &_mainEditView;
+ else if (isFromSecondary)
+ notifyView = &_subEditView;
+ else
+ return FALSE;
+
DocTabView *notifyDocTab = isFromPrimary?&_mainDocTab:&_subDocTab;
TBHDR * tabNotification = (TBHDR*) notification;
switch (notification->nmhdr.code)
@@ -485,7 +491,10 @@ BOOL Notepad_plus::notify(SCNotification *notification)
_pEditView->marginClick(notification->position, notification->modifiers);
if (_pDocMap)
_pDocMap->fold(lineClick, _pEditView->isFolded(lineClick));
- _smartHighlighter.highlightView(_pEditView);
+
+ ScintillaEditView * unfocusView = isFromPrimary ? &_subEditView : &_mainEditView;
+
+ _smartHighlighter.highlightView(_pEditView, unfocusView);
}
else if ((notification->margin == ScintillaEditView::_SC_MARGE_SYBOLE) && !notification->modifiers)
{
@@ -692,6 +701,7 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_UPDATEUI:
{
NppParameters *nppParam = NppParameters::getInstance();
+ NppGUI & nppGui = const_cast(nppParam->getNppGUI());
// replacement for obsolete custom SCN_SCROLLED
if (notification->updated & SC_UPDATE_V_SCROLL)
@@ -705,13 +715,21 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (nppParam->_isFindReplacing)
break;
- if (notification->nmhdr.hwndFrom != _pEditView->getHSelf())
+ 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())
+ {
+ TCHAR selectedText[1024];
+ _pEditView->getGenericSelectedText(selectedText, sizeof(selectedText)/sizeof(TCHAR), false);
+ _smartHighlighter.highlightViewWithWord(notifyView, selectedText);
+ }
break;
+ }
braceMatch();
- NppGUI & nppGui = const_cast(nppParam->getNppGUI());
-
if (nppGui._enableTagsMatchHilite)
{
XmlMatchedTagsHighlighter xmlTagMatchHiliter(_pEditView);
@@ -723,7 +741,10 @@ BOOL Notepad_plus::notify(SCNotification *notification)
if (nppGui._disableSmartHiliteTmp)
nppGui._disableSmartHiliteTmp = false;
else
- _smartHighlighter.highlightView(notifyView);
+ {
+ ScintillaEditView * anbotherView = isFromPrimary ? &_subEditView : &_mainEditView;
+ _smartHighlighter.highlightView(notifyView, anbotherView);
+ }
}
updateStatusBar();
@@ -799,7 +820,8 @@ BOOL Notepad_plus::notify(SCNotification *notification)
case SCN_ZOOM:
{
- _smartHighlighter.highlightView(notifyView);
+ ScintillaEditView * unfocusView = isFromPrimary ? &_subEditView : &_mainEditView;
+ _smartHighlighter.highlightView(notifyView, unfocusView);
break;
}
diff --git a/PowerEditor/src/Parameters.cpp b/PowerEditor/src/Parameters.cpp
index 5091a6063..ed43da77f 100644
--- a/PowerEditor/src/Parameters.cpp
+++ b/PowerEditor/src/Parameters.cpp
@@ -4031,6 +4031,15 @@ void NppParameters::feedGUIParameters(TiXmlNode *node)
else if (!lstrcmp(val, TEXT("no")))
_nppGUI._smartHiliteUseFindSettings = false;
}
+
+ val = element->Attribute(TEXT("onAnotherView"));
+ if (val)
+ {
+ if (!lstrcmp(val, TEXT("yes")))
+ _nppGUI._smartHiliteOnAnotherView = true;
+ else if (!lstrcmp(val, TEXT("no")))
+ _nppGUI._smartHiliteOnAnotherView = false;
+ }
}
}
@@ -5438,12 +5447,13 @@ void NppParameters::createXmlTreeFromGUIParams()
GUIConfigElement->SetAttribute(TEXT("searchEngineCustom"), _nppGUI._searchEngineCustom);
}
- // yes
+ // yes
{
TiXmlElement *GUIConfigElement = insertGUIConfigBoolNode(newGUIRoot, TEXT("SmartHighLight"), _nppGUI._enableSmartHilite);
GUIConfigElement->SetAttribute(TEXT("matchCase"), _nppGUI._smartHiliteCaseSensitive ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("wholeWordOnly"), _nppGUI._smartHiliteWordOnly ? TEXT("yes") : TEXT("no"));
GUIConfigElement->SetAttribute(TEXT("useFindSettings"), _nppGUI._smartHiliteUseFindSettings ? TEXT("yes") : TEXT("no"));
+ GUIConfigElement->SetAttribute(TEXT("onAnotherView"), _nppGUI._smartHiliteOnAnotherView ? TEXT("yes") : TEXT("no"));
}
//
diff --git a/PowerEditor/src/Parameters.h b/PowerEditor/src/Parameters.h
index 583c77a3d..fb5121094 100644
--- a/PowerEditor/src/Parameters.h
+++ b/PowerEditor/src/Parameters.h
@@ -750,6 +750,7 @@ struct NppGUI final
bool _smartHiliteCaseSensitive = false;
bool _smartHiliteWordOnly = true;
bool _smartHiliteUseFindSettings = false;
+ bool _smartHiliteOnAnotherView = false;
bool _disableSmartHiliteTmp = false;
bool _enableTagsMatchHilite = true;
diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp
index 0276155c8..9e542fba1 100644
--- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp
+++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp
@@ -1631,14 +1631,18 @@ int FindReplaceDlg::processAll(ProcessOperation op, const FindOption *opt, bool
return processRange(op, findReplaceInfo, pFindersInfo, pOptions, colourStyleID);
}
-int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findReplaceInfo, const FindersInfo * pFindersInfo, const FindOption *opt, int colourStyleID)
+int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findReplaceInfo, const FindersInfo * pFindersInfo, const FindOption *opt, int colourStyleID, ScintillaEditView *view2Process)
{
int nbProcessed = 0;
if (!isCreated() && not findReplaceInfo._txt2find)
return nbProcessed;
- if ((op == ProcessReplaceAll) && (*_ppEditView)->getCurrentBuffer()->isReadOnly())
+ ScintillaEditView *pEditView = *_ppEditView;
+ if (view2Process)
+ pEditView = view2Process;
+
+ if ((op == ProcessReplaceAll) && pEditView->getCurrentBuffer()->isReadOnly())
return nbProcessed;
if (findReplaceInfo._startRange == findReplaceInfo._endRange)
@@ -1710,9 +1714,9 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
if (op == ProcessMarkAll && colourStyleID == -1) //if marking, check if purging is needed
{
if (_env->_doPurge) {
- (*_ppEditView)->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE);
+ pEditView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE);
if (_env->_doMarkLine)
- (*_ppEditView)->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK);
+ pEditView->execute(SCI_MARKERDELETEALL, MARK_BOOKMARK);
}
}
@@ -1720,20 +1724,20 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
int targetEnd = 0;
//Initial range for searching
- (*_ppEditView)->execute(SCI_SETSEARCHFLAGS, flags);
+ pEditView->execute(SCI_SETSEARCHFLAGS, flags);
bool findAllFileNameAdded = false;
while (targetStart != -1 && targetStart != -2)
{
- targetStart = (*_ppEditView)->searchInTarget(pTextFind, stringSizeFind, findReplaceInfo._startRange, findReplaceInfo._endRange);
+ targetStart = pEditView->searchInTarget(pTextFind, stringSizeFind, findReplaceInfo._startRange, findReplaceInfo._endRange);
// If we've not found anything, just break out of the loop
if (targetStart == -1 || targetStart == -2)
break;
- targetEnd = int((*_ppEditView)->execute(SCI_GETTARGETEND));
+ targetEnd = int(pEditView->execute(SCI_GETTARGETEND));
if (targetEnd > findReplaceInfo._endRange) { //we found a result but outside our range, therefore do not process it
break;
@@ -1757,9 +1761,9 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
findAllFileNameAdded = true;
}
- auto lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, targetStart);
- int lend = static_cast((*_ppEditView)->execute(SCI_GETLINEENDPOSITION, lineNumber));
- int lstart = static_cast((*_ppEditView)->execute(SCI_POSITIONFROMLINE, lineNumber));
+ auto lineNumber = pEditView->execute(SCI_LINEFROMPOSITION, targetStart);
+ int lend = static_cast(pEditView->execute(SCI_GETLINEENDPOSITION, lineNumber));
+ int lstart = static_cast(pEditView->execute(SCI_POSITIONFROMLINE, lineNumber));
int nbChar = lend - lstart;
// use the static buffer
@@ -1771,7 +1775,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
int start_mark = targetStart - lstart;
int end_mark = targetEnd - lstart;
- (*_ppEditView)->getGenericText(lineBuf, 1024, lstart, lend, &start_mark, &end_mark);
+ pEditView->getGenericText(lineBuf, 1024, lstart, lend, &start_mark, &end_mark);
generic_string line = lineBuf;
line += TEXT("\r\n");
@@ -1796,9 +1800,9 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
findAllFileNameAdded = true;
}
- auto lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, targetStart);
- int lend = static_cast((*_ppEditView)->execute(SCI_GETLINEENDPOSITION, lineNumber));
- int lstart = static_cast((*_ppEditView)->execute(SCI_POSITIONFROMLINE, lineNumber));
+ auto lineNumber = pEditView->execute(SCI_LINEFROMPOSITION, targetStart);
+ int lend = static_cast(pEditView->execute(SCI_GETLINEENDPOSITION, lineNumber));
+ int lstart = static_cast(pEditView->execute(SCI_POSITIONFROMLINE, lineNumber));
int nbChar = lend - lstart;
// use the static buffer
@@ -1810,7 +1814,7 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
int start_mark = targetStart - lstart;
int end_mark = targetEnd - lstart;
- (*_ppEditView)->getGenericText(lineBuf, 1024, lstart, lend, &start_mark, &end_mark);
+ pEditView->getGenericText(lineBuf, 1024, lstart, lend, &start_mark, &end_mark);
generic_string line = lineBuf;
line += TEXT("\r\n");
@@ -1834,9 +1838,9 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
{
int replacedLength;
if (isRegExp)
- replacedLength = (*_ppEditView)->replaceTargetRegExMode(pTextReplace);
+ replacedLength = pEditView->replaceTargetRegExMode(pTextReplace);
else
- replacedLength = (*_ppEditView)->replaceTarget(pTextReplace);
+ replacedLength = pEditView->replaceTarget(pTextReplace);
replaceDelta = replacedLength - foundTextLen;
break;
@@ -1850,17 +1854,17 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
// on the same line would simply not be shown. This may have been fixed in later version of Scintilla.
if (foundTextLen > 0)
{
- (*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE);
- (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
+ pEditView->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE);
+ pEditView->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
}
if (_env->_doMarkLine)
{
- auto lineNumber = (*_ppEditView)->execute(SCI_LINEFROMPOSITION, targetStart);
- auto state = (*_ppEditView)->execute(SCI_MARKERGET, lineNumber);
+ auto lineNumber = pEditView->execute(SCI_LINEFROMPOSITION, targetStart);
+ auto state = pEditView->execute(SCI_MARKERGET, lineNumber);
if (!(state & (1 << MARK_BOOKMARK)))
- (*_ppEditView)->execute(SCI_MARKERADD, lineNumber, MARK_BOOKMARK);
+ pEditView->execute(SCI_MARKERADD, lineNumber, MARK_BOOKMARK);
}
break;
}
@@ -1870,8 +1874,8 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
// See comment by ProcessMarkAll
if (foundTextLen > 0)
{
- (*_ppEditView)->execute(SCI_SETINDICATORCURRENT, colourStyleID);
- (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
+ pEditView->execute(SCI_SETINDICATORCURRENT, colourStyleID);
+ pEditView->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
}
break;
}
@@ -1881,8 +1885,8 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
// See comment by ProcessMarkAll
if (foundTextLen > 0)
{
- (*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_SMART);
- (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
+ pEditView->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_SMART);
+ pEditView->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
}
break;
}
@@ -1892,8 +1896,8 @@ int FindReplaceDlg::processRange(ProcessOperation op, FindReplaceInfo & findRepl
// See comment by ProcessMarkAll
if (foundTextLen > 0)
{
- (*_ppEditView)->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_INC);
- (*_ppEditView)->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
+ pEditView->execute(SCI_SETINDICATORCURRENT, SCE_UNIVERSAL_FOUND_STYLE_INC);
+ pEditView->execute(SCI_INDICATORFILLRANGE, targetStart, foundTextLen);
}
break;
}
diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h
index 341f286d9..c5fc6e04a 100644
--- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h
+++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.h
@@ -255,7 +255,7 @@ public :
int processAll(ProcessOperation op, const FindOption *opt, bool isEntire = false, const FindersInfo *pFindersInfo = nullptr, int colourStyleID = -1);
- int processRange(ProcessOperation op, FindReplaceInfo & findReplaceInfo, const FindersInfo *pFindersInfo, const FindOption *opt = NULL, int colourStyleID = -1);
+ int processRange(ProcessOperation op, FindReplaceInfo & findReplaceInfo, const FindersInfo *pFindersInfo, const FindOption *opt = nullptr, int colourStyleID = -1, ScintillaEditView *view2Process = nullptr);
void replaceAllInOpenedDocs();
void findAllIn(InWhat op);
diff --git a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp
index 4f31a6a97..cdc4b2c6d 100644
--- a/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp
+++ b/PowerEditor/src/ScitillaComponent/SmartHighlighter.cpp
@@ -37,20 +37,97 @@ SmartHighlighter::SmartHighlighter(FindReplaceDlg * pFRDlg)
//Nothing to do
}
-void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView)
+void SmartHighlighter::highlightViewWithWord(ScintillaEditView * pHighlightView, const generic_string & word2Hilite)
+{
+ // save target locations for other search functions
+ auto originalStartPos = pHighlightView->execute(SCI_GETTARGETSTART);
+ auto originalEndPos = pHighlightView->execute(SCI_GETTARGETEND);
+
+ // Get the range of text visible and highlight everything in it
+ auto firstLine = static_cast(pHighlightView->execute(SCI_GETFIRSTVISIBLELINE));
+ auto nbLineOnScreen = pHighlightView->execute(SCI_LINESONSCREEN);
+ auto nrLines = min(nbLineOnScreen, MAXLINEHIGHLIGHT) + 1;
+ auto lastLine = firstLine + nrLines;
+ int startPos = 0;
+ int endPos = 0;
+ auto currentLine = firstLine;
+ int prevDocLineChecked = -1; //invalid start
+
+ // Determine mode for SmartHighlighting
+ bool isWordOnly = true;
+ bool isCaseSensentive = true;
+
+ const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
+
+ if (nppGUI._smartHiliteUseFindSettings)
+ {
+ // fetch find dialog's setting
+ NppParameters *nppParams = NppParameters::getInstance();
+ FindHistory &findHistory = nppParams->getFindHistory();
+ isWordOnly = findHistory._isMatchWord;
+ isCaseSensentive = findHistory._isMatchCase;
+ }
+ else
+ {
+ isWordOnly = nppGUI._smartHiliteWordOnly;
+ isCaseSensentive = nppGUI._smartHiliteCaseSensitive;
+ }
+
+ FindOption fo;
+ fo._isMatchCase = isCaseSensentive;
+ fo._isWholeWord = isWordOnly;
+
+ FindReplaceInfo frInfo;
+ frInfo._txt2find = word2Hilite.c_str();
+
+ for (; currentLine < lastLine; ++currentLine)
+ {
+ int docLine = static_cast(pHighlightView->execute(SCI_DOCLINEFROMVISIBLE, currentLine));
+ if (docLine == prevDocLineChecked)
+ continue; //still on same line (wordwrap)
+ prevDocLineChecked = docLine;
+ startPos = static_cast(pHighlightView->execute(SCI_POSITIONFROMLINE, docLine));
+ endPos = static_cast(pHighlightView->execute(SCI_POSITIONFROMLINE, docLine + 1));
+
+ frInfo._startRange = startPos;
+ frInfo._endRange = endPos;
+ if (endPos == -1)
+ { //past EOF
+ frInfo._endRange = pHighlightView->getCurrentDocLen() - 1;
+ _pFRDlg->processRange(ProcessMarkAll_2, frInfo, NULL, &fo, -1, pHighlightView);
+ break;
+ }
+ else
+ {
+ _pFRDlg->processRange(ProcessMarkAll_2, frInfo, NULL, &fo, -1, pHighlightView);
+ }
+ }
+
+ // restore the original targets to avoid conflicts with the search/replace functions
+ pHighlightView->execute(SCI_SETTARGETRANGE, originalStartPos, originalEndPos);
+}
+
+void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView, ScintillaEditView * unfocusView)
{
// Clear marks
pHighlightView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_SMART);
+ const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
+
// If nothing selected, dont mark anything
if (pHighlightView->execute(SCI_GETSELECTIONEMPTY) == 1)
+ {
+ if (nppGUI._smartHiliteOnAnotherView && unfocusView && unfocusView->isVisible()
+ && unfocusView->getCurrentBufferID() != pHighlightView->getCurrentBufferID())
+ {
+ unfocusView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_SMART);
+ }
return;
+ }
auto curPos = pHighlightView->execute(SCI_GETCURRENTPOS);
auto range = pHighlightView->getSelection();
- const NppGUI & nppGUI = NppParameters::getInstance()->getNppGUI();
-
// Determine mode for SmartHighlighting
bool isWordOnly = true;
bool isCaseSensentive = true;
@@ -84,57 +161,19 @@ void SmartHighlighter::highlightView(ScintillaEditView * pHighlightView)
char * text2Find = new char[textlen];
pHighlightView->getSelectedText(text2Find, textlen, false); //do not expand selection (false)
- // save target locations for other search functions
- auto originalStartPos = pHighlightView->execute(SCI_GETTARGETSTART);
- auto originalEndPos = pHighlightView->execute(SCI_GETTARGETEND);
-
- // Get the range of text visible and highlight everything in it
- auto firstLine = static_cast(pHighlightView->execute(SCI_GETFIRSTVISIBLELINE));
- auto nbLineOnScreen = pHighlightView->execute(SCI_LINESONSCREEN);
- auto nrLines = min(nbLineOnScreen, MAXLINEHIGHLIGHT ) + 1;
- auto lastLine = firstLine + nrLines;
- int startPos = 0;
- int endPos = 0;
- auto currentLine = firstLine;
- int prevDocLineChecked = -1; //invalid start
-
- FindOption fo;
- fo._isMatchCase = isCaseSensentive;
- fo._isWholeWord = isWordOnly;
-
- const TCHAR * searchText = NULL;
-
WcharMbcsConvertor *wmc = WcharMbcsConvertor::getInstance();
UINT cp = static_cast(pHighlightView->execute(SCI_GETCODEPAGE));
const TCHAR * text2FindW = wmc->char2wchar(text2Find, cp);
- searchText = text2FindW;
- for(; currentLine < lastLine; ++currentLine)
+ highlightViewWithWord(pHighlightView, text2FindW);
+
+ if (nppGUI._smartHiliteOnAnotherView && unfocusView && unfocusView->isVisible()
+ && unfocusView->getCurrentBufferID() != pHighlightView->getCurrentBufferID())
{
- int docLine = static_cast(pHighlightView->execute(SCI_DOCLINEFROMVISIBLE, currentLine));
- if (docLine == prevDocLineChecked)
- continue; //still on same line (wordwrap)
- prevDocLineChecked = docLine;
- startPos = static_cast(pHighlightView->execute(SCI_POSITIONFROMLINE, docLine));
- endPos = static_cast(pHighlightView->execute(SCI_POSITIONFROMLINE, docLine + 1));
- FindReplaceInfo frInfo;
- frInfo._txt2find = searchText;
- frInfo._startRange = startPos;
- frInfo._endRange = endPos;
- if (endPos == -1)
- { //past EOF
- frInfo._endRange = pHighlightView->getCurrentDocLen() - 1;
- _pFRDlg->processRange(ProcessMarkAll_2, frInfo, NULL, &fo);
- break;
- }
- else
- {
- _pFRDlg->processRange(ProcessMarkAll_2, frInfo, NULL, &fo);
- }
+ // Clear marks
+ unfocusView->clearIndicator(SCE_UNIVERSAL_FOUND_STYLE_SMART);
+ highlightViewWithWord(unfocusView, text2FindW);
}
- // restore the original targets to avoid conflicts with the search/replace functions
- pHighlightView->execute(SCI_SETTARGETRANGE, originalStartPos, originalEndPos);
-
delete[] text2Find;
}
diff --git a/PowerEditor/src/ScitillaComponent/SmartHighlighter.h b/PowerEditor/src/ScitillaComponent/SmartHighlighter.h
index e2a3e7a91..0562c3525 100644
--- a/PowerEditor/src/ScitillaComponent/SmartHighlighter.h
+++ b/PowerEditor/src/ScitillaComponent/SmartHighlighter.h
@@ -28,13 +28,17 @@
#ifndef SMARTHIGHLIGHTER_H
#define SMARTHIGHLIGHTER_H
+#include "Common.h"
+
class ScintillaEditView;
class FindReplaceDlg;
class SmartHighlighter {
public:
explicit SmartHighlighter(FindReplaceDlg * pFRDlg);
- void highlightView(ScintillaEditView * pHighlightView);
+ void highlightView(ScintillaEditView * pHighlightView, ScintillaEditView * unfocusView);
+ void highlightViewWithWord(ScintillaEditView * pHighlightView, const generic_string & word2Hilite);
+
private:
FindReplaceDlg * _pFRDlg;
};
diff --git a/PowerEditor/src/WinControls/Preference/preference.rc b/PowerEditor/src/WinControls/Preference/preference.rc
index aa843ad7e..1c3454625 100644
--- a/PowerEditor/src/WinControls/Preference/preference.rc
+++ b/PowerEditor/src/WinControls/Preference/preference.rc
@@ -229,11 +229,12 @@ IDD_PREFERENCE_HILITE_BOX DIALOGEX 0, 0, 455, 185
STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
- GROUPBOX "Smart Highlighting",IDC_SMARTHILITING_STATIC,147,21,155,67,BS_CENTER
+ GROUPBOX "Smart Highlighting",IDC_SMARTHILITING_STATIC,147,21,155,81,BS_CENTER
CONTROL "Enable",IDC_CHECK_ENABLSMARTHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,31,142,10
CONTROL "Match case",IDC_CHECK_SMARTHILITECASESENSITIVE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,45,142,10
CONTROL "Match whole word only",IDC_CHECK_SMARTHILITEWHOLEWORDONLY, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,58,142,10
CONTROL "Use Find dialog settings",IDC_CHECK_SMARTHILITEUSEFINDSETTINGS, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,72,142,10
+ CONTROL "Highlight another view",IDC_CHECK_SMARTHILITEANOTHERRVIEW, "Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,86,142,10
GROUPBOX "Highlight Matching Tags",IDC_TAGMATCHEDHILITE_STATIC,147,110,155,55,BS_CENTER
CONTROL "Enable",IDC_CHECK_ENABLTAGSMATCHHILITE,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,155,120,140,10
diff --git a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
index 231436079..5bec6e1c7 100644
--- a/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
+++ b/PowerEditor/src/WinControls/Preference/preferenceDlg.cpp
@@ -1920,6 +1920,7 @@ INT_PTR CALLBACK Highlighting::run_dlgProc(UINT message, WPARAM wParam, LPARAM/*
::SendDlgItemMessage(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE, BM_SETCHECK, nppGUI._smartHiliteCaseSensitive, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SMARTHILITEWHOLEWORDONLY, BM_SETCHECK, nppGUI._smartHiliteWordOnly, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_SMARTHILITEUSEFINDSETTINGS, BM_SETCHECK, nppGUI._smartHiliteUseFindSettings, 0);
+ ::SendDlgItemMessage(_hSelf, IDC_CHECK_SMARTHILITEANOTHERRVIEW, BM_SETCHECK, nppGUI._smartHiliteOnAnotherView, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLTAGSMATCHHILITE, BM_SETCHECK, nppGUI._enableTagsMatchHilite, 0);
::SendDlgItemMessage(_hSelf, IDC_CHECK_ENABLTAGATTRHILITE, BM_SETCHECK, nppGUI._enableTagAttrsHilite, 0);
@@ -1931,6 +1932,7 @@ INT_PTR CALLBACK Highlighting::run_dlgProc(UINT message, WPARAM wParam, LPARAM/*
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE), nppGUI._enableSmartHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEWHOLEWORDONLY), nppGUI._enableSmartHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEUSEFINDSETTINGS), nppGUI._enableSmartHilite);
+ ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEANOTHERRVIEW), nppGUI._enableSmartHilite);
ETDTProc enableDlgTheme = reinterpret_cast(pNppParam->getEnableThemeDlgTexture());
if (enableDlgTheme)
@@ -1954,6 +1956,7 @@ INT_PTR CALLBACK Highlighting::run_dlgProc(UINT message, WPARAM wParam, LPARAM/*
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITECASESENSITIVE), nppGUI._enableSmartHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEWHOLEWORDONLY), nppGUI._enableSmartHilite);
::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEUSEFINDSETTINGS), nppGUI._enableSmartHilite);
+ ::EnableWindow(::GetDlgItem(_hSelf, IDC_CHECK_SMARTHILITEANOTHERRVIEW), nppGUI._enableSmartHilite);
HWND grandParent = ::GetParent(_hParent);
::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0);
return TRUE;
@@ -1997,6 +2000,14 @@ INT_PTR CALLBACK Highlighting::run_dlgProc(UINT message, WPARAM wParam, LPARAM/*
::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0);
return TRUE;
}
+ case IDC_CHECK_SMARTHILITEANOTHERRVIEW:
+ {
+ nppGUI._smartHiliteOnAnotherView = isCheckedOrNot(IDC_CHECK_SMARTHILITEANOTHERRVIEW);
+
+ HWND grandParent = ::GetParent(_hParent);
+ ::SendMessage(grandParent, NPPM_INTERNAL_CLEARINDICATOR, 0, 0);
+ return TRUE;
+ }
case IDC_CHECK_ENABLTAGSMATCHHILITE:
{
diff --git a/PowerEditor/src/WinControls/Preference/preference_rc.h b/PowerEditor/src/WinControls/Preference/preference_rc.h
index 0a980c858..ae182bf24 100644
--- a/PowerEditor/src/WinControls/Preference/preference_rc.h
+++ b/PowerEditor/src/WinControls/Preference/preference_rc.h
@@ -186,6 +186,7 @@
#define IDC_WORKSPACEFILEEXT_STATIC (IDD_PREFERENCE_SETTING_BOX + 37)
#define IDC_CHECK_SMARTHILITEWHOLEWORDONLY (IDD_PREFERENCE_SETTING_BOX + 38)
#define IDC_CHECK_SMARTHILITEUSEFINDSETTINGS (IDD_PREFERENCE_SETTING_BOX + 39)
+ #define IDC_CHECK_SMARTHILITEANOTHERRVIEW (IDD_PREFERENCE_SETTING_BOX + 40)
//-- xFileEditViewHistoryParameterGUI: Additional Checkbox for enabling the history for restoring the edit view per file.
#define IDC_CHECK_REMEMBEREDITVIEWPERFILE (IDD_PREFERENCE_SETTING_BOX + 41)