[BUG_FIXED] (Author: Andreas Jonsson) Fix some problems with Find/Replace dialog messages like "1 hits in 1 files".

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@930 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2012-07-20 23:37:40 +00:00
parent 83bd722c0a
commit dbd2df8571

View File

@ -922,10 +922,13 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
generic_string result = TEXT("");
if (nbReplaced < 0)
result = TEXT("The regular expression to search is formed badly");
result = TEXT("The regular expression is malformed.");
else
{
TCHAR moreInfo[64];
if(nbReplaced == 1)
wsprintf(moreInfo, TEXT("1 occurrence was replaced."));
else
wsprintf(moreInfo, TEXT("%d occurrences were replaced."), nbReplaced);
result = moreInfo;
}
@ -948,11 +951,14 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
generic_string result = TEXT("");
if (nbCounted < 0)
result = TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?");
result = TEXT("The regular expression to search is malformed.\r\nDoes it result in nothing?");
else
{
TCHAR moreInfo[128];
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbCounted);
if(nbCounted == 1)
wsprintf(moreInfo, TEXT("1 match."));
else
wsprintf(moreInfo, TEXT("%d matches."), nbCounted);
result = moreInfo;
}
if (isMacroRecording) saveInMacro(wParam, FR_OP_FIND);
@ -977,11 +983,14 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
nppParamInst->_isFindReplacing = false;
generic_string result = TEXT("");
if (nbMarked < 0)
result = TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?");
result = TEXT("The regular expression to search is malformed.\r\nDoes it result in nothing?");
else
{
TCHAR moreInfo[128];
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbMarked);
if(nbMarked == 1)
wsprintf(moreInfo, TEXT("1 match."));
else
wsprintf(moreInfo, TEXT("%d matches."), nbMarked);
result = moreInfo;
}
::MessageBox(_hParent, result.c_str(), TEXT("Mark"), MB_OK);
@ -1760,6 +1769,9 @@ void FindReplaceDlg::findAllIn(InWhat op)
if (::SendMessage(_hParent, cmdid, 0, 0))
{
if(_findAllResult == 1)
wsprintf(_findAllResultStr, TEXT("1 hit"));
else
wsprintf(_findAllResultStr, TEXT("%d hits"), _findAllResult);
if (_findAllResult)
{
@ -2009,10 +2021,13 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri
generic_string result = TEXT("");
if (nbReplaced < 0)
result = TEXT("The regular expression to search is formed badly");
result = TEXT("The regular expression is malformed.");
else
{
TCHAR moreInfo[64];
if(nbReplaced == 1)
wsprintf(moreInfo, TEXT("1 occurrence was replaced."));
else
wsprintf(moreInfo, TEXT("%d occurrences were replaced."), nbReplaced);
result = moreInfo;
}
@ -2025,11 +2040,14 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri
generic_string result = TEXT("");
if (nbCounted < 0)
result = TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?");
result = TEXT("The regular expression to search is malformed.\r\nDoes it result in nothing?");
else
{
TCHAR moreInfo[128];
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbCounted);
if(nbCounted == 1)
wsprintf(moreInfo, TEXT("1 match."));
else
wsprintf(moreInfo, TEXT("%d matches."), nbCounted);
result = moreInfo;
}
::MessageBox(_hParent, result.c_str(), TEXT("Count"), MB_OK);
@ -2042,11 +2060,14 @@ void FindReplaceDlg::execSavedCommand(int cmd, int intValue, generic_string stri
nppParamInst->_isFindReplacing = false;
generic_string result = TEXT("");
if (nbMarked < 0)
result = TEXT("The regular expression to search is formed badly.\r\nIs it resulting in nothing?");
result = TEXT("The regular expression to search is malformed.\r\nDoes it result in nothing?");
else
{
TCHAR moreInfo[128];
wsprintf(moreInfo, TEXT("%d match(es) to occurrence(s)"), nbMarked);
if(nbMarked == 1)
wsprintf(moreInfo, TEXT("1 match."));
else
wsprintf(moreInfo, TEXT("%d matches."), nbMarked);
result = moreInfo;
}
::MessageBox(_hParent, result.c_str(), TEXT("Mark"), MB_OK);
@ -2254,6 +2275,9 @@ void Finder::addFileNameTitle(const TCHAR * fileName)
void Finder::addFileHitCount(int count)
{
TCHAR text[20];
if(count == 1)
wsprintf(text, TEXT(" (1 hit)"));
else
wsprintf(text, TEXT(" (%i hits)"), count);
setFinderReadOnly(false);
_scintView.insertGenericTextFrom(_lastFileHeaderPos, text);
@ -2264,6 +2288,13 @@ void Finder::addFileHitCount(int count)
void Finder::addSearchHitCount(int count)
{
TCHAR text[50];
if(count == 1 && nFoundFiles == 1)
wsprintf(text, TEXT(" (1 hit in 1 file)"));
else if(count == 1 && nFoundFiles != 1)
wsprintf(text, TEXT(" (1 hit in %i files)"), nFoundFiles);
else if(count != 1 && nFoundFiles == 1)
wsprintf(text, TEXT(" (%i hits in 1 file)"), count);
else if(count != 1 && nFoundFiles != 1)
wsprintf(text, TEXT(" (%i hits in %i files)"), count, nFoundFiles);
setFinderReadOnly(false);
_scintView.insertGenericTextFrom(_lastSearchHeaderPos, text);