[ENHANCEMENT] (Author: Jinhui Yang) Enhance Find/Replace dialog statusbar message.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1043 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-05-17 23:59:44 +00:00
parent 865eded304
commit 532275abb0

View File

@ -689,8 +689,16 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
updateCombo(IDFINDWHAT); updateCombo(IDFINDWHAT);
nppParamInst->_isFindReplacing = true; nppParamInst->_isFindReplacing = true;
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND); if (isMacroRecording)
processFindNext(_options._str2Search.c_str()); saveInMacro(wParam, FR_OP_FIND);
FindStatus findStatus = FSFound;
processFindNext(_options._str2Search.c_str(), _env, &findStatus);
if(findStatus == FSEndReached)
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the top. The end of document has been reached."), FSMessage);
else if(findStatus == FSTopReached)
setStatusbarMessage(TEXT("Find: Found the 1st occurrence from the bottom. The begin of document has been reached."), FSMessage);
nppParamInst->_isFindReplacing = false; nppParamInst->_isFindReplacing = false;
} }
return TRUE; return TRUE;
@ -1359,12 +1367,26 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
replacedLen = (*_ppEditView)->replaceTarget(pTextReplace); replacedLen = (*_ppEditView)->replaceTarget(pTextReplace);
} }
(*_ppEditView)->execute(SCI_SETSEL, start + replacedLen, start + replacedLen); (*_ppEditView)->execute(SCI_SETSEL, start + replacedLen, start + replacedLen);
// Do the next find // Do the next find
moreMatches = processFindNext(txt2find, &replaceOptions, &status, FINDNEXTTYPE_REPLACENEXT); moreMatches = processFindNext(txt2find, &replaceOptions, &status, FINDNEXTTYPE_REPLACENEXT);
generic_string msg = TEXT("Replace: 1 occurrence was replaced. ");
msg += moreMatches?TEXT("The next occurence found"):TEXT("The next occurence not found"); if (status == FSEndReached)
setStatusbarMessage(msg, FSMessage); {
setStatusbarMessage(TEXT("Replace: Replaced the 1st occurrence from the top. The end of document has been reached."), FSMessage);
//displayMsgDone = true;
}
else if (status == FSTopReached)
{
setStatusbarMessage(TEXT("Replace: Replaced the 1st occurrence from the bottom. The begin of document has been reached."), FSMessage);
//displayMsgDone = true;
}
else
{
generic_string msg = TEXT("Replace: 1 occurrence was replaced. ");
msg += moreMatches?TEXT("The next occurence found"):TEXT("The next occurence not found");
setStatusbarMessage(msg, FSMessage);
}
} }
} }
else else