mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-07-27 07:44:24 +02:00
Increase search input length from 2046 to 16383
* The search input length has been extended from (2048 - 1) up to (16384 - 1) characters. * For saving find input history, only search strings shorter than 2048 characters will be stored for the next session. * The tooltip warning is displayed in both cases above. Fix #16749, fix #1088, close #16855
This commit is contained in:
parent
f5a34dcc9f
commit
22c5063d26
@ -1889,7 +1889,8 @@ If you select advanced mode but do not edit files in the aforementioned language
|
||||
<statusbar-Sel value="Sel: "/>
|
||||
<statusbar-Sel-number value="Sel"/>
|
||||
<toolbar-accent-tip value="This option makes your toolbar icons follow Windows system accent color. Accent color is the highlight color used in buttons, borders, and Start menu tiles in Windows. To change it, go to Settings > Personalization > Colors, then select your preferred accent color."/>
|
||||
<max-len-on-search-tip value="Only 2046 characters are allowed for the find/replace text length - your input could be truncated."/>
|
||||
<max-len-on-search-tip value="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."/>
|
||||
<max-len-on-save-tip value="This search input (> $INT_REPLACE$ characters) won't be saved for the next session."/>
|
||||
<goto-setting-tip value="Find your setting here"/>
|
||||
</MiscStrings>
|
||||
</Native-Langue>
|
||||
|
@ -1889,7 +1889,8 @@ If you select advanced mode but do not edit files in the aforementioned language
|
||||
<statusbar-Sel value="Sel: "/>
|
||||
<statusbar-Sel-number value="Sel"/>
|
||||
<toolbar-accent-tip value="This option makes your toolbar icons follow Windows system accent color. Accent color is the highlight color used in buttons, borders, and Start menu tiles in Windows. To change it, go to Settings > Personalization > Colors, then select your preferred accent color."/>
|
||||
<max-len-on-search-tip value="Only 2046 characters are allowed for the find/replace text length - your input could be truncated."/>
|
||||
<max-len-on-search-tip value="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."/>
|
||||
<max-len-on-save-tip value="This search input (> $INT_REPLACE$ characters) won't be saved for the next session."/>
|
||||
<goto-setting-tip value="Find your setting here"/>
|
||||
</MiscStrings>
|
||||
</Native-Langue>
|
||||
|
@ -1884,7 +1884,8 @@ Si vous sélectionnez le mode avancé sans modifier les fichiers des langues men
|
||||
<statusbar-Sel value="Sel : "/>
|
||||
<statusbar-Sel-number value="Sel"/>
|
||||
<toolbar-accent-tip value="Cette option permet aux icônes de votre barre d'outils d'adopter la couleur d'accentuation du système Windows. La couleur d'accentuation est la couleur de surbrillance utilisée pour les boutons, les bordures et les tuiles du menu Démarrer sous Windows. Pour la modifier, accédez à Paramètres > Personnalisation > Couleurs, puis sélectionnez votre couleur d'accentuation préférée."/>
|
||||
<max-len-on-search-tip value="Seuls 2046 caractères sont autorisés pour la longueur du texte de recherche/remplacement - votre entrée pourrait être tronquée."/>
|
||||
<max-len-on-search-tip value="Seuls $INT_REPLACE$ caractères sont autorisés pour la longueur du texte de recherche/remplacement - votre saisie pourrait être tronquée et ne serait pas enregistrée pour la session suivante."/>
|
||||
<max-len-on-save-tip value="Cette entrée de recherche (> $INT_REPLACE$ caractères) ne sera pas enregistrée pour la prochaine session."/>
|
||||
<goto-setting-tip value="Réglage du paramètre ici"/>
|
||||
</MiscStrings>
|
||||
</Native-Langue>
|
||||
|
@ -1708,7 +1708,8 @@ C、C++、Java、C#、Objective-C、PHP、JavaScript、JSP、CSS、Perl、Rust
|
||||
<statusbar-Sel value="選取:"/>
|
||||
<statusbar-Sel-number value="選取"/>
|
||||
<toolbar-accent-tip value="此選項可讓您的工具列圖示遵循 Windows 系統強調色。強調色是 Windows 中的按鈕、邊框和開始功能表圖塊所使用的反白顯示顏色。要更改它,請轉到「設定」>「個性化」>「顏色」,然後選擇您喜歡的強調色。"/>
|
||||
<max-len-on-search-tip value="尋找/取代文字長度僅允許 2046 個字元 - 您的輸入可能會被截斷。"/>
|
||||
<max-len-on-search-tip value="尋找/取代文字長度僅允許 $INT_REPLACE$ 個字元 - 您的輸入可能會被截斷,此搜尋輸入也將不會保存以供下次 Notepad++ 啟動時使用。"/>
|
||||
<max-len-on-save-tip value="此搜尋輸入( > $INT_REPLACE$ 個字元)將不會保存以供下次 Notepad++ 啟動時使用。"/>
|
||||
<goto-setting-tip value="相關的偏好設定在此"/>
|
||||
</MiscStrings>
|
||||
</Native-Langue>
|
||||
|
@ -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<LPARAM>(L""));
|
||||
}
|
||||
@ -506,7 +511,7 @@ int FindReplaceDlg::saveComboHistory(int id, int maxcount, vector<wstring> & 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<LPARAM>(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())
|
||||
|
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user