mirror of
https://github.com/notepad-plus-plus/notepad-plus-plus.git
synced 2025-12-07 21:59:45 +01:00
Fix "Select & Find Next" command not working regression
Regression introduced by:
be59048c5e (diff-ce3b24898ed0287ecacacc4d6c1712fb9eaf1ed67b36fd87315b8e80950de03aL1463)
Fix #17200, close #17206
This commit is contained in:
parent
c6aa7f9ec8
commit
1f3b2ebe2d
@ -1443,8 +1443,8 @@ void Notepad_plus::command(int id)
|
|||||||
if (isFirstTime)
|
if (isFirstTime)
|
||||||
_findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL(), false);
|
_findReplaceDlg.doDialog(FIND_DLG, _nativeLangSpeaker.isRTL(), false);
|
||||||
|
|
||||||
const wchar_t* str = _findReplaceDlg.setSearchTextWithSettings();
|
wstring str = _findReplaceDlg.setSearchText();
|
||||||
if (!str) return;
|
if (str.empty()) return;
|
||||||
|
|
||||||
_findReplaceDlg._env->_str2Search = str;
|
_findReplaceDlg._env->_str2Search = str;
|
||||||
|
|
||||||
@ -1457,7 +1457,7 @@ void Notepad_plus::command(int id)
|
|||||||
op._whichDirection = (id == IDM_SEARCH_SETANDFINDNEXT?DIR_DOWN:DIR_UP);
|
op._whichDirection = (id == IDM_SEARCH_SETANDFINDNEXT?DIR_DOWN:DIR_UP);
|
||||||
|
|
||||||
FindStatus status = FSNoMessage;
|
FindStatus status = FSNoMessage;
|
||||||
_findReplaceDlg.processFindNext(str, &op, &status);
|
_findReplaceDlg.processFindNext(str.c_str(), &op, &status);
|
||||||
if (status == FSEndReached)
|
if (status == FSEndReached)
|
||||||
{
|
{
|
||||||
wstring msg = _nativeLangSpeaker.getLocalizedStrFromID("find-status-end-reached", FIND_STATUS_END_REACHED_TEXT);
|
wstring msg = _nativeLangSpeaker.getLocalizedStrFromID("find-status-end-reached", FIND_STATUS_END_REACHED_TEXT);
|
||||||
|
|||||||
@ -5375,10 +5375,27 @@ bool FindReplaceDlg::replaceInOpenDocsConfirmCheck()
|
|||||||
return confirmed;
|
return confirmed;
|
||||||
}
|
}
|
||||||
|
|
||||||
// return NULL if nothing to set in find field.
|
// Expand selection (if needed) and set the selected text in Find What field.
|
||||||
// Otherwise return string pointer (wchar_t *) in which the selected text was copied.
|
// Return empty string if nothing to set in find field.
|
||||||
// Note that the string pointer don't need to and should not be deallocated.
|
// Otherwise return string in which the selected text was copied.
|
||||||
const wchar_t* FindReplaceDlg::setSearchTextWithSettings()
|
wstring FindReplaceDlg::setSearchText()
|
||||||
|
{
|
||||||
|
const NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
|
||||||
|
Sci_Position selStrCharNum = 0;
|
||||||
|
const wchar_t* selStr = (*_ppEditView)->getSelectedTextToWChar(true, &selStrCharNum);
|
||||||
|
|
||||||
|
if (selStr && selStrCharNum <= nppGui._fillFindWhatThreshold)
|
||||||
|
{
|
||||||
|
setSearchText(selStr);
|
||||||
|
return selStr;
|
||||||
|
}
|
||||||
|
return L"";
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set the selected text in Find What field, according the Search settings.
|
||||||
|
// Return empty string if nothing to set in find field.
|
||||||
|
// Otherwise return string in which the selected text was copied.
|
||||||
|
wstring FindReplaceDlg::setSearchTextWithSettings()
|
||||||
{
|
{
|
||||||
const NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
|
const NppGUI& nppGui = NppParameters::getInstance().getNppGUI();
|
||||||
if (nppGui._fillFindFieldWithSelected)
|
if (nppGui._fillFindFieldWithSelected)
|
||||||
@ -5392,7 +5409,7 @@ const wchar_t* FindReplaceDlg::setSearchTextWithSettings()
|
|||||||
return selStr;
|
return selStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nullptr;
|
return L"";
|
||||||
}
|
}
|
||||||
|
|
||||||
wstring Finder::getHitsString(int count) const
|
wstring Finder::getHitsString(int count) const
|
||||||
|
|||||||
@ -419,7 +419,8 @@ public :
|
|||||||
DIALOG_TYPE getCurrentStatus() { return _currentStatus; }
|
DIALOG_TYPE getCurrentStatus() { return _currentStatus; }
|
||||||
Finder* getFinderFrom(HWND hwnd);
|
Finder* getFinderFrom(HWND hwnd);
|
||||||
int regexBackwardMsgBox();
|
int regexBackwardMsgBox();
|
||||||
const wchar_t* setSearchTextWithSettings();
|
std::wstring setSearchText();
|
||||||
|
std::wstring setSearchTextWithSettings();
|
||||||
|
|
||||||
protected :
|
protected :
|
||||||
void resizeDialogElements();
|
void resizeDialogElements();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user