Add support for non-printing char in main Search Result dock window

ref: https://github.com/notepad-plus-plus/notepad-plus-plus/pull/13020#issuecomment-1430034599

Close #13128
This commit is contained in:
ozone10 2023-02-14 19:15:51 +01:00 committed by Don Ho
parent 278f694f3a
commit d30b789d67
5 changed files with 59 additions and 5 deletions

View File

@ -1762,6 +1762,7 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
const bool isShown = nppParam.getSVP()._npcShow; const bool isShown = nppParam.getSVP()._npcShow;
_mainEditView.showNpc(isShown); _mainEditView.showNpc(isShown);
_subEditView.showNpc(isShown); _subEditView.showNpc(isShown);
_findReplaceDlg.updateFinderScintillaForNpc();
return TRUE; return TRUE;
} }
@ -2939,8 +2940,14 @@ LRESULT Notepad_plus::process(HWND hwnd, UINT message, WPARAM wParam, LPARAM lPa
case NPPM_INTERNAL_NPCFORMCHANGED: case NPPM_INTERNAL_NPCFORMCHANGED:
{ {
_mainEditView.setNPC(); NppParameters& nppParam = NppParameters::getInstance();
_subEditView.setNPC(); const bool isShown = nppParam.getSVP()._npcShow;
if (isShown)
{
_mainEditView.setNPC();
_subEditView.setNPC();
_findReplaceDlg.updateFinderScintillaForNpc(true);
}
return TRUE; return TRUE;
} }

View File

@ -2368,6 +2368,8 @@ void Notepad_plus::command(int id)
setCheckMenuItem(IDM_VIEW_ALL_CHARACTERS, allChecked); setCheckMenuItem(IDM_VIEW_ALL_CHARACTERS, allChecked);
_toolBar.setCheck(IDM_VIEW_ALL_CHARACTERS, allChecked); _toolBar.setCheck(IDM_VIEW_ALL_CHARACTERS, allChecked);
_findReplaceDlg.updateFinderScintillaForNpc();
break; break;
} }
@ -2393,6 +2395,8 @@ void Notepad_plus::command(int id)
svp1._eolShow = isChecked; svp1._eolShow = isChecked;
svp1._npcShow = isChecked; svp1._npcShow = isChecked;
_findReplaceDlg.updateFinderScintillaForNpc();
break; break;
} }

View File

@ -3074,8 +3074,11 @@ void FindReplaceDlg::findAllIn(InWhat op)
_pFinder->_scintView.showMargin(ScintillaEditView::_SC_MARGE_SYMBOL, false); _pFinder->_scintView.showMargin(ScintillaEditView::_SC_MARGE_SYMBOL, false);
_pFinder->_scintView.setMakerStyle(FOLDER_STYLE_SIMPLE); _pFinder->_scintView.setMakerStyle(FOLDER_STYLE_SIMPLE);
NppDarkMode::setBorder(_pFinder->_scintView.getHSelf());
_pFinder->_scintView.display(); _pFinder->_scintView.display();
_pFinder->setFinderStyle(); _pFinder->setFinderStyle();
_pFinder->setFinderStyleForNpc();
_pFinder->display(false); _pFinder->display(false);
::UpdateWindow(_hParent); ::UpdateWindow(_hParent);
@ -3207,7 +3210,9 @@ Finder * FindReplaceDlg::createFinder()
pFinder->_scintView.display(); pFinder->_scintView.display();
::UpdateWindow(_hParent); ::UpdateWindow(_hParent);
NppDarkMode::setBorder(pFinder->_scintView.getHSelf());
pFinder->setFinderStyle(); pFinder->setFinderStyle();
pFinder->setFinderStyleForNpc();
// Send the address of _MarkingsStruct to the lexer // Send the address of _MarkingsStruct to the lexer
char ptrword[sizeof(void*) * 2 + 1]; char ptrword[sizeof(void*) * 2 + 1];
@ -4770,7 +4775,7 @@ void Finder::setFinderStyle()
// Set global styles for the finder // Set global styles for the finder
_scintView.performGlobalStyles(); _scintView.performGlobalStyles();
NppDarkMode::setBorder(_scintView.getHSelf()); NppDarkMode::setDarkScrollBar(_scintView.getHSelf());
// Set current line background color for the finder // Set current line background color for the finder
const TCHAR * lexerName = ScintillaEditView::_langNameInfoArray[L_SEARCHRESULT]._langName; const TCHAR * lexerName = ScintillaEditView::_langNameInfoArray[L_SEARCHRESULT]._langName;
@ -4822,6 +4827,20 @@ void Finder::setFinderStyle()
_scintView.setMakerStyle(svp._folderStyle == FOLDER_STYLE_NONE ? FOLDER_STYLE_BOX : svp._folderStyle); _scintView.setMakerStyle(svp._folderStyle == FOLDER_STYLE_NONE ? FOLDER_STYLE_BOX : svp._folderStyle);
} }
void Finder::setFinderStyleForNpc(bool onlyColor)
{
NppParameters& nppParam = NppParameters::getInstance();
const bool isShown = nppParam.getSVP()._npcShow;
if (!onlyColor)
{
_scintView.showNpc(isShown, true);
}
else if (isShown)
{
_scintView.setNPC();
}
}
intptr_t CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam) intptr_t CALLBACK Finder::run_dlgProc(UINT message, WPARAM wParam, LPARAM lParam)
{ {
switch (message) switch (message)

View File

@ -125,6 +125,7 @@ public:
void addSearchHitCount(int count, int countSearched, bool isMatchLines, bool searchedEntireNotSelection); void addSearchHitCount(int count, int countSearched, bool isMatchLines, bool searchedEntireNotSelection);
const char* foundLine(FoundInfo fi, SearchResultMarkingLine mi, const TCHAR* foundline, size_t totalLineNumber); const char* foundLine(FoundInfo fi, SearchResultMarkingLine mi, const TCHAR* foundline, size_t totalLineNumber);
void setFinderStyle(); void setFinderStyle();
void setFinderStyleForNpc(bool onlyColor = false);
void removeAll(); void removeAll();
void openAll(); void openAll();
void wrapLongLinesToggle(); void wrapLongLinesToggle();
@ -352,6 +353,29 @@ public :
if (_pFinder && _pFinder->isCreated()) if (_pFinder && _pFinder->isCreated())
{ {
_pFinder->setFinderStyle(); _pFinder->setFinderStyle();
if (!_findersOfFinder.empty())
{
for (const auto& finder : _findersOfFinder)
{
finder->setFinderStyle();
}
}
}
};
void updateFinderScintillaForNpc(bool onlyColor = false) {
if (_pFinder && _pFinder->isCreated())
{
_pFinder->setFinderStyleForNpc(onlyColor);
if (!_findersOfFinder.empty())
{
for (const auto& finder : _findersOfFinder)
{
finder->setFinderStyleForNpc();
}
}
} }
}; };

View File

@ -409,7 +409,7 @@ public:
return (execute(SCI_GETVIEWEOL) != 0); return (execute(SCI_GETVIEWEOL) != 0);
}; };
void showNpc(bool willBeShowed = true) { void showNpc(bool willBeShowed = true, bool isSearchResult = false) {
auto& svp = NppParameters::getInstance().getSVP(); auto& svp = NppParameters::getInstance().getSVP();
if (willBeShowed) if (willBeShowed)
{ {
@ -429,7 +429,7 @@ public:
execute(SCI_CLEARALLREPRESENTATIONS); execute(SCI_CLEARALLREPRESENTATIONS);
// SCI_CLEARALLREPRESENTATIONS will also reset CRLF // SCI_CLEARALLREPRESENTATIONS will also reset CRLF
if (svp._eolMode != svp.roundedRectangleText) if (!isSearchResult && svp._eolMode != svp.roundedRectangleText)
{ {
setCRLF(); setCRLF();
} }