From 4db18efa2045156f5a0c8ce335145843ccf956e4 Mon Sep 17 00:00:00 2001 From: Takashi Sawanaka Date: Thu, 22 Feb 2018 21:35:06 +0900 Subject: [PATCH] Fix to show text that contains & on message box, correctly. sf.net#2067 (2) --- Externals/crystaledit/editlib/ceditreplacedlg.cpp | 2 -- Externals/crystaledit/editlib/cfindtextdlg.cpp | 1 - Src/Common/MessageBoxDialog.cpp | 4 +++- Src/Common/MessageBoxDialog.h | 1 + 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Externals/crystaledit/editlib/ceditreplacedlg.cpp b/Externals/crystaledit/editlib/ceditreplacedlg.cpp index 5294aa03e..9ed9d58b1 100644 --- a/Externals/crystaledit/editlib/ceditreplacedlg.cpp +++ b/Externals/crystaledit/editlib/ceditreplacedlg.cpp @@ -211,7 +211,6 @@ DoHighlightText ( bool bNotifyIfNotFound ) if ( bNotifyIfNotFound ) { CString prompt, text(m_sText); - text.Replace(_T("&"), _T("&&")); prompt.Format (LoadResString(IDS_EDIT_TEXT_NOT_FOUND).c_str(), (LPCTSTR)text); AfxMessageBox (prompt, MB_ICONINFORMATION); } @@ -252,7 +251,6 @@ DoReplaceText (LPCTSTR /*pszNewText*/, DWORD dwSearchFlags) if (!bFound) { CString prompt, text(m_sText); - text.Replace(_T("&"), _T("&&")); prompt.Format (LoadResString(IDS_EDIT_TEXT_NOT_FOUND).c_str(), (LPCTSTR)text); AfxMessageBox (prompt, MB_ICONINFORMATION); if (m_nScope == 0) diff --git a/Externals/crystaledit/editlib/cfindtextdlg.cpp b/Externals/crystaledit/editlib/cfindtextdlg.cpp index 367af4b8b..dddbad933 100644 --- a/Externals/crystaledit/editlib/cfindtextdlg.cpp +++ b/Externals/crystaledit/editlib/cfindtextdlg.cpp @@ -99,7 +99,6 @@ FindText (int nDirection) if (!m_pBuddy->FindText(GetLastSearchInfos())) { CString prompt, text(m_sText); - text.Replace(_T("&"), _T("&&")); prompt.Format (LoadResString(IDS_EDIT_TEXT_NOT_FOUND).c_str(), (LPCTSTR)text); AfxMessageBox (prompt, MB_ICONINFORMATION); } diff --git a/Src/Common/MessageBoxDialog.cpp b/Src/Common/MessageBoxDialog.cpp index 9b8876a6c..ba75a2a71 100644 --- a/Src/Common/MessageBoxDialog.cpp +++ b/Src/Common/MessageBoxDialog.cpp @@ -1328,7 +1328,9 @@ void CMessageBoxDialog::CreateMessageControl ( ) } // Create the static control for the message. - m_stcMessage.Create(m_strMessage.c_str(), dwStyle, rcDummy, this, + String strMessage = m_strMessage; + strutils::replace(strMessage, _T("&"), _T("&&")); + m_stcMessage.Create(strMessage.c_str(), dwStyle, rcDummy, this, (UINT)IDC_STATIC); // Check whether the text will be read from right to left. diff --git a/Src/Common/MessageBoxDialog.h b/Src/Common/MessageBoxDialog.h index 6ec4336be..1e753fdfd 100644 --- a/Src/Common/MessageBoxDialog.h +++ b/Src/Common/MessageBoxDialog.h @@ -31,6 +31,7 @@ #pragma once #include "resource.h" +#include "UnicodeString.h" #include ////////////////////////////////////////////////////////////////////////////// -- 2.11.0