[ENHANCEMENT] Mark all (5 styles available) feature checks 2 options "Match case" and "Match whole word only" in Find/Replace dialog. If a part of the word is selected, then "Match whole word only" will be always false, whatever the value is in Find/Replace dialog.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1122 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-09-18 17:52:34 +00:00
parent 82281c7d2d
commit 4105c3d2fa
3 changed files with 15 additions and 7 deletions

View File

@ -692,13 +692,19 @@ void Notepad_plus::command(int id)
const int strSize = FINDREPLACE_MAXLENGTH;
TCHAR text2Find[strSize];
TCHAR text2Find2[strSize];
_pEditView->getGenericSelectedText(text2Find, strSize, false);
_pEditView->getGenericWordOnCaretPos(text2Find2, strSize);
if (text2Find[0] == '\0')
{
_pEditView->getGenericWordOnCaretPos(text2Find, strSize);
_findReplaceDlg.markAll(text2Find2, styleID, true);
}
else
{
_findReplaceDlg.markAll(text2Find, styleID, lstrlen(text2Find) == lstrlen(text2Find2));
}
_findReplaceDlg.markAll(text2Find, styleID);
break;
}
case IDM_SEARCH_UNMARKALLEXT1 :

View File

@ -1407,11 +1407,13 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
int FindReplaceDlg::markAll(const TCHAR *txt2find, int styleID)
int FindReplaceDlg::markAll(const TCHAR *txt2find, int styleID, bool isWholeWordSelected)
{
FindOption opt;
opt._isMatchCase = true;
opt._isWholeWord = false;
opt._isMatchCase = _options._isMatchCase;
// if whole word is selected for being colorized, isWholeWord option in Find/Replace dialog will be checked
// otherwise this option is false, because user may want to find the words contain the parts to search
opt._isWholeWord = isWholeWordSelected?_options._isWholeWord:false;
opt._str2Search = txt2find;
int nbFound = processAll(ProcessMarkAllExt, &opt, true, NULL, styleID);

View File

@ -220,7 +220,7 @@ public :
bool processFindNext(const TCHAR *txt2find, const FindOption *options = NULL, FindStatus *oFindStatus = NULL, FindNextType findNextType = FINDNEXTTYPE_FINDNEXT);
bool processReplace(const TCHAR *txt2find, const TCHAR *txt2replace, const FindOption *options = NULL);
int markAll(const TCHAR *txt2find, int styleID);
int markAll(const TCHAR *txt2find, int styleID, bool isWholeWordSelected);
//int markAll2(const TCHAR *str2find);
int markAllInc(const FindOption *opt);