Don't populate in Find what if a stream selection more than 1024 characters

Avoid auto-population into "Find What" if "In Selection" is going to be auto-checkmarked.

Fix #12603, close #12603
pull/13168/head
Alan Kilborn 2023-02-24 08:58:24 -05:00 committed by Don Ho
parent 9c0e1e4559
commit fa9504d595
3 changed files with 6 additions and 2 deletions

View File

@ -1249,7 +1249,10 @@ void Notepad_plus::command(int id)
if (nppGui._fillFindFieldWithSelected) if (nppGui._fillFindFieldWithSelected)
{ {
_pEditView->getGenericSelectedText(str, strSize, nppGui._fillFindFieldSelectCaret); _pEditView->getGenericSelectedText(str, strSize, nppGui._fillFindFieldSelectCaret);
_findReplaceDlg.setSearchText(str); if (lstrlen(str) <= FINDREPLACE_INSEL_TEXTSIZE_THRESHOLD)
{
_findReplaceDlg.setSearchText(str);
}
} }
setFindReplaceFolderFilter(NULL, NULL); setFindReplaceFolderFilter(NULL, NULL);

View File

@ -1442,7 +1442,7 @@ intptr_t CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARA
if (!_options._isInSelection) if (!_options._isInSelection)
{ {
if (nbSelected <= 1024) if (nbSelected <= FINDREPLACE_INSEL_TEXTSIZE_THRESHOLD)
{ {
checkVal = BST_UNCHECKED; checkVal = BST_UNCHECKED;
_options._isInSelection = false; _options._isInSelection = false;

View File

@ -28,6 +28,7 @@
#define FIND_INHIDDENDIR 2 #define FIND_INHIDDENDIR 2
#define FINDREPLACE_MAXLENGTH 2048 #define FINDREPLACE_MAXLENGTH 2048
#define FINDREPLACE_INSEL_TEXTSIZE_THRESHOLD 1024
#define FINDTEMPSTRING_MAXSIZE 1024*1024 #define FINDTEMPSTRING_MAXSIZE 1024*1024