Fix ampersands in find dialog status bar.

pull/7/head
Andreas Jönsson 10 years ago
parent ac61c43d15
commit 5bacca3601

@ -1146,6 +1146,18 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
return FALSE; return FALSE;
} }
generic_string replaceString(generic_string subject, const generic_string& search, const generic_string& replace)
{
size_t pos = 0;
while ((pos = subject.find(search, pos)) != std::string::npos)
{
subject.replace(pos, search.length(), replace);
pos += replace.length();
}
return subject;
}
// return value : // return value :
// true : the text2find is found // true : the text2find is found
// false : the text2find is not found // false : the text2find is not found
@ -1275,7 +1287,8 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
if (NotIncremental == pOptions->_incrementalType) //incremental search doesnt trigger messages if (NotIncremental == pOptions->_incrementalType) //incremental search doesnt trigger messages
{ {
generic_string msg = TEXT("Find: Can't find the text \""); generic_string msg = TEXT("Find: Can't find the text \"");
msg += txt2find; generic_string txt2find_escaped = replaceString(txt2find, TEXT("&"), TEXT("&&"));
msg += txt2find_escaped;
msg += TEXT("\""); msg += TEXT("\"");
setStatusbarMessage(msg, FSNotFound); setStatusbarMessage(msg, FSNotFound);

Loading…
Cancel
Save