@@ -3890,23 +3890,24 @@ void CSearchDlg::SearchFile(CSearchInfo sInfo, const std::wstring& searchRoot, b
3890
3890
bLoadResult = textFile.Load (sInfo .filePath .c_str (), type, m_bUTF8, bCancelled);
3891
3891
}
3892
3892
sInfo .encoding = type;
3893
+
3894
+ int ft = boost::regex::normal ;
3895
+ if (!bCaseSensitive)
3896
+ ft |= boost::regbase::icase;
3897
+ boost::match_flag_type flags = boost::match_default | boost::format_all;
3898
+ if (!bDotMatchesNewline)
3899
+ flags |= boost::match_not_dot_newline;
3900
+
3893
3901
if ((bLoadResult) && ((type != CTextFile::Binary) || (bIncludeBinary) || bSearchAlways))
3894
3902
{
3895
3903
sInfo .readError = false ;
3896
3904
std::wstring::const_iterator start, end;
3897
3905
start = textFile.GetFileString ().begin ();
3898
3906
end = textFile.GetFileString ().end ();
3899
- boost::match_results<std::wstring::const_iterator> what;
3900
3907
try
3901
3908
{
3902
- int ft = boost::regex::normal ;
3903
- if (!bCaseSensitive)
3904
- ft |= boost::regbase::icase;
3905
3909
boost::wregex expression = boost::wregex (localSearchString, ft);
3906
3910
boost::match_results<std::wstring::const_iterator> whatC;
3907
- boost::match_flag_type flags = boost::match_default | boost::format_all;
3908
- if (!bDotMatchesNewline)
3909
- flags |= boost::match_not_dot_newline;
3910
3911
while (!bCancelled && regex_search (start, end, whatC, expression, flags))
3911
3912
{
3912
3913
if (whatC[0 ].matched )
@@ -3961,7 +3962,7 @@ void CSearchDlg::SearchFile(CSearchInfo sInfo, const std::wstring& searchRoot, b
3961
3962
flags |= boost::match_prev_avail;
3962
3963
flags |= boost::match_not_bob;
3963
3964
}
3964
- if (type == CTextFile::Binary)
3965
+ if (nFound == 0 && type == CTextFile::Binary)
3965
3966
{
3966
3967
boost::wregex expressionUtf16 = boost::wregex (searchStringUtf16Le, ft);
3967
3968
start = textFile.GetFileString ().begin ();
@@ -4158,14 +4159,6 @@ void CSearchDlg::SearchFile(CSearchInfo sInfo, const std::wstring& searchRoot, b
4158
4159
searchFor += " \\ E" ;
4159
4160
}
4160
4161
4161
- boost::match_results<std::string::const_iterator> what;
4162
- boost::match_flag_type flags = boost::match_default | boost::format_all;
4163
- if (!bDotMatchesNewline)
4164
- flags |= boost::match_not_dot_newline;
4165
- int ft = boost::regex::normal ;
4166
- if (!bCaseSensitive)
4167
- ft |= boost::regbase::icase;
4168
-
4169
4162
try
4170
4163
{
4171
4164
boost::regex expression = boost::regex (searchFor, ft);
@@ -4199,7 +4192,7 @@ void CSearchDlg::SearchFile(CSearchInfo sInfo, const std::wstring& searchRoot, b
4199
4192
break ;
4200
4193
}
4201
4194
}
4202
- if (type == CTextFile::Binary && !m_bReplace)
4195
+ if (nFound == 0 && type == CTextFile::Binary && !m_bReplace)
4203
4196
{
4204
4197
boost::wregex expressionUtf16Le = boost::wregex (searchString, ft);
4205
4198
boost::spirit::classic::file_iterator<wchar_t > start (filePath.c_str ());
0 commit comments