diff --git a/PowerEditor/installer/nativeLang/english.xml b/PowerEditor/installer/nativeLang/english.xml
index b13244607..753d10f38 100644
--- a/PowerEditor/installer/nativeLang/english.xml
+++ b/PowerEditor/installer/nativeLang/english.xml
@@ -1889,7 +1889,8 @@ If you select advanced mode but do not edit files in the aforementioned language
-
+
+
diff --git a/PowerEditor/installer/nativeLang/english_customizable.xml b/PowerEditor/installer/nativeLang/english_customizable.xml
index d8eef206f..29f2c2096 100644
--- a/PowerEditor/installer/nativeLang/english_customizable.xml
+++ b/PowerEditor/installer/nativeLang/english_customizable.xml
@@ -1889,7 +1889,8 @@ If you select advanced mode but do not edit files in the aforementioned language
-
+
+
diff --git a/PowerEditor/installer/nativeLang/french.xml b/PowerEditor/installer/nativeLang/french.xml
index 5bcf93ea0..1d55bba5b 100644
--- a/PowerEditor/installer/nativeLang/french.xml
+++ b/PowerEditor/installer/nativeLang/french.xml
@@ -1884,7 +1884,8 @@ Si vous sélectionnez le mode avancé sans modifier les fichiers des langues men
-
+
+
diff --git a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
index f7cc9b95e..b464e3b3f 100644
--- a/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
+++ b/PowerEditor/installer/nativeLang/taiwaneseMandarin.xml
@@ -1708,7 +1708,8 @@ C、C++、Java、C#、Objective-C、PHP、JavaScript、JSP、CSS、Perl、Rust
-
+
+
diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp
index b15525068..8824a4715 100644
--- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp
+++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.cpp
@@ -61,19 +61,24 @@ void delLeftWordInEdit(HWND hEdit)
WORD cursor = 0;
::SendMessage(hEdit, EM_GETSEL, (WPARAM)&cursor, 0);
WORD wordstart = cursor;
- while (wordstart > 0) {
+ while (wordstart > 0)
+ {
wchar_t c = str[wordstart - 1];
if (c != ' ' && c != '\t')
break;
--wordstart;
}
- while (wordstart > 0) {
+
+ while (wordstart > 0)
+ {
wchar_t c = str[wordstart - 1];
if (c == ' ' || c == '\t')
break;
--wordstart;
}
- if (wordstart < cursor) {
+
+ if (wordstart < cursor)
+ {
::SendMessage(hEdit, EM_SETSEL, (WPARAM)wordstart, (LPARAM)cursor);
::SendMessage(hEdit, EM_REPLACESEL, (WPARAM)TRUE, reinterpret_cast(L""));
}
@@ -506,7 +511,7 @@ int FindReplaceDlg::saveComboHistory(int id, int maxcount, vector & str
for (int i = 0 ; i < count ; ++i)
{
auto cbTextLen = ::SendMessage(hCombo, CB_GETLBTEXTLEN, i, 0);
- if (cbTextLen <= FINDREPLACE_MAXLENGTH - 1)
+ if (cbTextLen <= FINDREPLACE_MAXLENGTH2SAVE - 1)
{
::SendMessage(hCombo, CB_GETLBTEXT, i, reinterpret_cast(text));
strings.push_back(wstring(text));
@@ -1551,8 +1556,8 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
HWND hFindCombo = ::GetDlgItem(_hSelf, IDFINDWHAT);
HWND hReplaceCombo = ::GetDlgItem(_hSelf, IDREPLACEWITH);
- ::SendMessage(hFindCombo, CB_LIMITTEXT, FINDREPLACE_MAXLENGTH - 2, 0);
- ::SendMessage(hReplaceCombo, CB_LIMITTEXT, FINDREPLACE_MAXLENGTH - 2, 0);
+ ::SendMessage(hFindCombo, CB_LIMITTEXT, FINDREPLACE_MAXLENGTH - 1, 0);
+ ::SendMessage(hReplaceCombo, CB_LIMITTEXT, FINDREPLACE_MAXLENGTH - 1, 0);
HWND hFiltersCombo = ::GetDlgItem(_hSelf, IDD_FINDINFILES_FILTERS_COMBO);
HWND hDirCombo = ::GetDlgItem(_hSelf, IDD_FINDINFILES_DIR_COMBO);
@@ -1945,12 +1950,18 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
{
HWND hComboBox = ::GetDlgItem(_hSelf, LOWORD(wParam));
LRESULT length = ::GetWindowTextLength(hComboBox);
- if (length >= FINDREPLACE_MAXLENGTH - 2)
+
+
+ if (length >= FINDREPLACE_MAXLENGTH - 1)
{
if (!_maxLenOnSearchTip.isValid()) // Create the tooltip and add the tool ONLY ONCE
{
NativeLangSpeaker* pNativeSpeaker = nppParamInst.getNativeLangSpeaker();
- static wstring maxLenOnSearchTip = pNativeSpeaker->getLocalizedStrFromID("max-len-on-search-tip", L"Only 2046 characters are allowed for the find/replace text length - your input could be truncated.");
+ wstring tip = pNativeSpeaker->getLocalizedStrFromID("max-len-on-search-tip", L"Only $INT_REPLACE$ characters are allowed for the find/replace text length - your input could be truncated, and it won't be saved for the next session.");
+ tip = stringReplace(tip, L"$INT_REPLACE$", std::to_wstring(FINDREPLACE_MAXLENGTH - 1));
+
+ static wstring maxLenOnSearchTip = tip;
+
bool isSuccessful = _maxLenOnSearchTip.init(_hInst, hComboBox, _hSelf, maxLenOnSearchTip.c_str(), _isRTL);
if (!isSuccessful)
@@ -1962,6 +1973,27 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
}
_maxLenOnSearchTip.show();
}
+ else if (length >= FINDREPLACE_MAXLENGTH2SAVE - 1) // FINDREPLACE_MAXLENGTH2SAVE < length < FINDREPLACE_MAXLENGTH
+ {
+ if (!_maxLenOnSearchTip.isValid()) // Create the tooltip and add the tool ONLY ONCE
+ {
+ NativeLangSpeaker* pNativeSpeaker = nppParamInst.getNativeLangSpeaker();
+ wstring tip = pNativeSpeaker->getLocalizedStrFromID("max-len-on-save-tip", L"This search input (> $INT_REPLACE$ characters) won't be saved for the next session");
+ tip = stringReplace(tip, L"$INT_REPLACE$", std::to_wstring(FINDREPLACE_MAXLENGTH2SAVE - 1));
+
+ static wstring maxLenOnSaveTip = tip;
+
+ bool isSuccessful = _maxLenOnSearchTip.init(_hInst, hComboBox, _hSelf, maxLenOnSaveTip.c_str(), _isRTL);
+
+ if (!isSuccessful)
+ {
+ return FALSE;
+ }
+
+ NppDarkMode::setDarkTooltips(_maxLenOnSearchTip.getTipHandle(), NppDarkMode::ToolTipsType::tooltip);
+ }
+ _maxLenOnSearchTip.show();
+ }
else
{
if (_maxLenOnSearchTip.isValid())
diff --git a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h
index 0a88d810d..bfc2fefb0 100644
--- a/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h
+++ b/PowerEditor/src/ScintillaComponent/FindReplaceDlg.h
@@ -29,7 +29,8 @@
#define FIND_INVALID_REGULAR_EXPRESSION -2
-#define FINDREPLACE_MAXLENGTH 2048
+#define FINDREPLACE_MAXLENGTH 16384 // the maximum length of the string (decrease 1 for '\0') to search in the editor
+#define FINDREPLACE_MAXLENGTH2SAVE 2048 // the maximum length of the string (decrease 1 for '\0') to save in the config.xml file
#define FINDTEMPSTRING_MAXSIZE 1024*1024