Improve compatibility for IDC_FINDNEXT and IDC_FINDPREV macros

Close #8064, close #8065
This commit is contained in:
Scott Sumner 2020-03-24 20:28:28 -04:00 committed by Don HO
parent 585cc27b1f
commit 13f0717a1b
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E

View File

@ -2660,14 +2660,30 @@ void FindReplaceDlg::execSavedCommand(int cmd, uptr_t intValue, const generic_st
NppParameters& nppParamInst = NppParameters::getInstance();
switch (intValue)
{
case IDC_FINDNEXT: // retro-compatible to 7.8.4 and older versions
case IDC_FINDPREV: // retro-compatible to 7.8.4 and older versions
case IDOK:
nppParamInst._isFindReplacing = true;
processFindNext(_env->_str2Search.c_str());
nppParamInst._isFindReplacing = false;
break;
case IDC_FINDNEXT:
// IDC_FINDNEXT will not be recorded into new macros recorded with 7.8.5 and later
// stay playback compatible with 7.5.5 - 7.8.4 where IDC_FINDNEXT was allowed but unneeded/undocumented
nppParamInst._isFindReplacing = true;
_env->_whichDirection = DIR_DOWN;
processFindNext(_env->_str2Search.c_str());
nppParamInst._isFindReplacing = false;
break;
case IDC_FINDPREV:
// IDC_FINDPREV will not be recorded into new macros recorded with 7.8.5 and later
// stay playback compatible with 7.5.5 - 7.8.4 where IDC_FINDPREV was allowed but unneeded/undocumented
nppParamInst._isFindReplacing = true;
_env->_whichDirection = DIR_UP;
processFindNext(_env->_str2Search.c_str());
nppParamInst._isFindReplacing = false;
break;
case IDREPLACE:
nppParamInst._isFindReplacing = true;
processReplace(_env->_str2Search.c_str(), _env->_str4Replace.c_str(), _env);