From 532275abb06cfacd625c79b11bd34e2c4c8f001e Mon Sep 17 00:00:00 2001 From: Don Ho Date: Fri, 17 May 2013 23:59:44 +0000 Subject: [PATCH] [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 --- .../src/ScitillaComponent/FindReplaceDlg.cpp | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 951313ee2..59ae16172 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -689,8 +689,16 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP updateCombo(IDFINDWHAT); nppParamInst->_isFindReplacing = true; - if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND); - processFindNext(_options._str2Search.c_str()); + if (isMacroRecording) + 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; } return TRUE; @@ -1359,12 +1367,26 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl replacedLen = (*_ppEditView)->replaceTarget(pTextReplace); } (*_ppEditView)->execute(SCI_SETSEL, start + replacedLen, start + replacedLen); - + // Do the next find 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"); - setStatusbarMessage(msg, FSMessage); + + if (status == FSEndReached) + { + 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