diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index d210cdec5..9cb330759 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -1666,6 +1666,7 @@ Find in all files but exclude all folders log or logs recursively:
+
diff --git a/PowerEditor/installer/nativeLang/english_customizable.xml b/PowerEditor/installer/nativeLang/english_customizable.xml
index e9baa93da..8e5ddd259 100644
--- a/PowerEditor/installer/nativeLang/english_customizable.xml
+++ b/PowerEditor/installer/nativeLang/english_customizable.xml
@@ -1666,6 +1666,7 @@ Find in all files but exclude all folders log or logs recursively:
+
diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml
index 9dc9eb42d..ceaa225e6 100644
--- a/PowerEditor/installer/nativeLang/french.xml
+++ b/PowerEditor/installer/nativeLang/french.xml
@@ -1652,6 +1652,7 @@ Rechercher dans tous les fichiers mais pas dans les dossiers log ou logs récurs
+
diff --git a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
index 4aae29876..d9e0ddf13 100644
--- a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
+++ b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
@@ -1530,9 +1530,10 @@
-
+
-
+
+
diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp
index 25aa0c28b..be4e393a4 100644
--- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp
+++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp
@@ -30,6 +30,8 @@ FindOption FindReplaceDlg::_options;
#define SHIFTED 0x8000
+const wstring noFoundPotentialReason = L"The given occurence cannot be found. You may have forgotten to check \"Wrap around\" (to ON), \"Match case\" (to OFF), or \"Match whole word only\" (to OFF).";
+
void addText2Combo(const TCHAR * txt2add, HWND hCombo)
{
if (!hCombo) return;
@@ -1984,7 +1986,14 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
result += TEXT(" ");
result += getScopeInfoForStatusBar(&_options);
- setStatusbarMessage(result, FSMessage);
+ wstring reasonMsg;
+ bool isTheMostLaxMode = _options._isWrapAround && !_options._isMatchCase && !_options._isWholeWord;
+ if (nbReplaced == 0 && !isTheMostLaxMode)
+ {
+ reasonMsg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find-pebkac-maybe", noFoundPotentialReason);
+ }
+
+ setStatusbarMessage(result, FSMessage, reasonMsg);
}
getFocus();
}
@@ -2021,8 +2030,15 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
}
result += TEXT(" ");
result += getScopeInfoForStatusBar(&_options);
-
- setStatusbarMessage(result, FSMessage);
+
+ wstring reasonMsg;
+ bool isTheMostLaxMode = _options._isWrapAround && !_options._isMatchCase && !_options._isWholeWord;
+ if (nbCounted == 0 && !isTheMostLaxMode)
+ {
+ reasonMsg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find-pebkac-maybe", noFoundPotentialReason);
+ }
+
+ setStatusbarMessage(result, FSMessage, reasonMsg);
}
if (isMacroRecording)
@@ -2068,7 +2084,14 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
result += TEXT(" ");
result += getScopeInfoForStatusBar(&_options);
- setStatusbarMessage(result, FSMessage);
+ wstring reasonMsg;
+ bool isTheMostLaxMode = _options._isWrapAround && !_options._isMatchCase && !_options._isWholeWord;
+ if (nbMarked == 0 && !isTheMostLaxMode)
+ {
+ reasonMsg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find-pebkac-maybe", noFoundPotentialReason);
+ }
+
+ setStatusbarMessage(result, FSMessage, reasonMsg);
}
getFocus();
@@ -2480,13 +2503,30 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
if (oFindStatus)
*oFindStatus = FSNotFound;
//failed, or failed twice with wrap
- if (NotIncremental == pOptions->_incrementalType) //incremental search doesnt trigger messages
+ if (pOptions->_incrementalType == NotIncremental) //incremental search doesnt trigger messages
{
- generic_string newTxt2find = stringReplace(txt2find, TEXT("&"), TEXT("&&"));
- NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
- generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find", TEXT("Find: Can't find the text \"$STR_REPLACE$\""));
- msg = stringReplace(msg, TEXT("$STR_REPLACE$"), newTxt2find);
- setStatusbarMessage(msg, FSNotFound);
+ NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
+ wstring warningMsg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find", L"Find: Can't find the text \"$STR_REPLACE$\"");
+ wstring newTxt2find = stringReplace(txt2find, L"&", L"&&");
+
+ if (newTxt2find.length() > 32) // truncate the search string to display, if the search string is too long
+ {
+ newTxt2find.erase(28);
+ newTxt2find += L"...";
+ }
+
+ warningMsg = stringReplace(warningMsg, L"$STR_REPLACE$", newTxt2find);
+
+ warningMsg += TEXT(" ");
+ warningMsg += getScopeInfoForStatusBar(&_options);
+
+ wstring reasonMsg;
+ bool isTheMostLaxMode = _options._isWrapAround && !_options._isMatchCase && !_options._isWholeWord;
+ if (!isTheMostLaxMode)
+ {
+ reasonMsg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find-pebkac-maybe", noFoundPotentialReason);
+ }
+ setStatusbarMessage(warningMsg, FSNotFound, reasonMsg);
// if the dialog is not shown, pass the focus to his parent(ie. Notepad++)
if (!::IsWindowVisible(_hSelf))
@@ -2633,11 +2673,22 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
}
else
{
- NativeLangSpeaker *pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
- generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-not-found", TEXT("Replace: no occurrence was found."));
-
if (_statusbarTooltipMsg.empty()) // Tooltip message non-empty means there's a find problem - so we keep the message as it is and not erase it
- setStatusbarMessage(msg, FSNotFound);
+ {
+ NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
+ generic_string msg = pNativeSpeaker->getLocalizedStrFromID("find-status-replace-not-found", TEXT("Replace: no occurrence was found"));
+
+ msg += L" ";
+ msg += getScopeInfoForStatusBar(&_options);
+
+ wstring reasonMsg;
+ bool isTheMostLaxMode = _options._isWrapAround && !_options._isMatchCase && !_options._isWholeWord;
+ if (!isTheMostLaxMode)
+ {
+ reasonMsg = pNativeSpeaker->getLocalizedStrFromID("find-status-cannot-find-pebkac-maybe", noFoundPotentialReason);
+ }
+ setStatusbarMessage(msg, FSNotFound, reasonMsg);
+ }
}
return moreMatches;
@@ -3609,14 +3660,15 @@ void FindReplaceDlg::saveInMacro(size_t cmd, int cmdType)
::SendMessage(_hParent, WM_FRSAVE_INT, IDC_FRCOMMAND_EXEC, cmd);
}
-void FindReplaceDlg::setStatusbarMessage(const generic_string & msg, FindStatus staus, char const *pTooltipMsg)
+void FindReplaceDlg::setStatusbarMessage(const wstring & msg, FindStatus staus, wstring tooltipMsg)
{
if (_statusbarTooltipWnd)
{
::DestroyWindow(_statusbarTooltipWnd);
_statusbarTooltipWnd = nullptr;
}
- _statusbarTooltipMsg = (pTooltipMsg && (*pTooltipMsg)) ? s2ws(pTooltipMsg) : TEXT("");
+
+ _statusbarTooltipMsg = tooltipMsg;
if (staus == FSNotFound)
{
@@ -3662,8 +3714,9 @@ void FindReplaceDlg::setStatusbarMessageWithRegExprErr(ScintillaEditView* pEditV
NativeLangSpeaker* pNativeSpeaker = (NppParameters::getInstance()).getNativeLangSpeaker();
std::wstring result = pNativeSpeaker->getLocalizedStrFromID("find-status-invalid-re", TEXT("Find: Invalid Regular Expression"));
-
- setStatusbarMessage(result, FSNotFound, msg);
+ string s = msg;
+
+ setStatusbarMessage(result, FSNotFound, s2ws(s));
}
generic_string FindReplaceDlg::getScopeInfoForStatusBar(FindOption const *pFindOpt) const
@@ -4448,7 +4501,7 @@ void FindReplaceDlg::drawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
::DrawText(lpDrawItemStruct->hDC, ptStr, lstrlen(ptStr), &rect, DT_SINGLELINE | DT_VCENTER | DT_LEFT);
- if (_statusbarTooltipMsg.length() == 0) return;
+ if (_statusbarTooltipMsg.empty()) return;
SIZE size{};
::GetTextExtentPoint32(lpDrawItemStruct->hDC, ptStr, lstrlen(ptStr), &size);
diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h
index 83a508b46..53799bf52 100644
--- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h
+++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h
@@ -386,7 +386,7 @@ public :
void execSavedCommand(int cmd, uptr_t intValue, const generic_string& stringValue);
void clearMarks(const FindOption& opt);
- void setStatusbarMessage(const generic_string & msg, FindStatus staus, char const *pTooltipMsg = NULL);
+ void setStatusbarMessage(const std::wstring & msg, FindStatus staus, std::wstring tooltipMsg = L"");
void setStatusbarMessageWithRegExprErr(ScintillaEditView* pEditView);
generic_string getScopeInfoForStatusBar(FindOption const *pFindOpt) const;
Finder * createFinder();