[BUG_FIXED] Fix the find in files crash issue if find what field contains 0x0A or 0xD.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@493 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2009-06-10 00:17:42 +00:00
parent 5b5c317872
commit e94b452d2a
5 changed files with 58 additions and 5 deletions

View File

@ -62,7 +62,7 @@ Included plugins (Unicode):
6. NppExport v0.2.8
7. Doc Monitor v2.2
8. NppNetNote v0.1
9. ChangeMarkers 1.2.0
9. ChangeMarkers 1.2.1
Included plugins (ANSI):
@ -75,4 +75,4 @@ Included plugins (ANSI):
7. Light Explorer v1.5
8. Doc Monitor v2.2
9. NppNetNote v0.1
10. ChangeMarkers 1.2.0
10. ChangeMarkers 1.2.1

View File

@ -751,6 +751,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
{
if (_currentStatus == FIND_DLG)
{
combo2ExtendedMode(IDFINDWHAT);
updateCombo(IDFINDWHAT);
nppParamInst->_isFindReplacing = true;
@ -762,6 +763,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
case IDC_FINDALL_CURRENTFILE :
{
combo2ExtendedMode(IDFINDWHAT);
updateCombo(IDFINDWHAT);
nppParamInst->_isFindReplacing = true;
@ -786,6 +788,7 @@ BOOL CALLBACK FindReplaceDlg::run_dlgProc(UINT message, WPARAM wParam, LPARAM lP
if ((lstrlen(directory) > 0) && (directory[lstrlen(directory)-1] != '\\'))
_directory += TEXT("\\");
combo2ExtendedMode(IDFINDWHAT);
updateCombo(IDFINDWHAT);
nppParamInst->_isFindReplacing = true;
@ -1736,6 +1739,55 @@ void FindReplaceDlg::getPatterns(vector<generic_string> & patternVect)
cutString(_filters.c_str(), patternVect);
}
void FindReplaceDlg::combo2ExtendedMode(int comboID)
{
HWND hFindCombo = ::GetDlgItem(_hSelf, comboID);
if (!hFindCombo) return;
generic_string str2transform = getTextFromCombo(hFindCombo);
// Count the number of character '\n' and '\r'
size_t nbEOL = 0;
size_t str2transformLen = lstrlen(str2transform.c_str());
for (size_t i = 0 ; i < str2transformLen ; i++)
{
if (str2transform[i] == '\r' || str2transform[i] == '\n')
nbEOL++;
}
if (nbEOL)
{
TCHAR * newBuffer = new TCHAR[str2transformLen + nbEOL*2 + 1];
int j = 0;
for (size_t i = 0 ; i < str2transformLen ; i++)
{
if (str2transform[i] == '\r')
{
newBuffer[j++] = '\\';
newBuffer[j++] = 'r';
}
else if (str2transform[i] == '\n')
{
newBuffer[j++] = '\\';
newBuffer[j++] = 'n';
}
else
{
newBuffer[j++] = str2transform[i];
}
}
newBuffer[j++] = '\0';
setSearchText(newBuffer);
_options._searchType = FindExtended;
::SendDlgItemMessage(_hSelf, IDNORMAL, BM_SETCHECK, FALSE, 0);
::SendDlgItemMessage(_hSelf, IDEXTENDED, BM_SETCHECK, TRUE, 0);
::SendDlgItemMessage(_hSelf, IDREGEXP, BM_SETCHECK, FALSE, 0);
delete [] newBuffer;
}
}
void Finder::setFinderStyle()
{
// Set global styles for the finder

View File

@ -428,6 +428,7 @@ protected :
// Call default (original) window procedure
return CallWindowProc((WNDPROC) originalFinderProc, hwnd, message, wParam, lParam);
}
void combo2ExtendedMode(int comboID);
private :
DIALOG_TYPE _currentStatus;

View File

@ -72,7 +72,7 @@
<GUIConfig name="noUpdate">no</GUIConfig>
<GUIConfig name="MaitainIndent">yes</GUIConfig>
<GUIConfig name="MRU">yes</GUIConfig>
<GUIConfig name="URL">0</GUIConfig>
<GUIConfig name="URL">2</GUIConfig>
<GUIConfig name="globalOverride" fg="no" bg="no" font="no" fontSize="no" bold="no" italic="no" underline="no" />
<GUIConfig name="auto-completion" autoCAction="0" triggerFromNbChar="1" />
<GUIConfig name="sessionExt"></GUIConfig>

View File

@ -10,9 +10,9 @@ To build Notepad++ package from source code:
For generating the executable file (notepad++.exe), you can use VC++ 7 / VC++ 8 or MinGW 3.0 / 2.X (a makefile is available, but not maintained).
A CMakeLists.txt (located in the PowerEditor\src directory) is available for generating the different VC project and MinGW makefile via cmake.
For generating the the dll file (SciLexer.dll), you have 2 choices as well : VC++ 6 (from v2.5) or MinGW 3.0 / 2.X
For generating the the dll file (SciLexer.dll), you have 2 choices : VC++ 6 (from v2.5) or MinGW 3.0 / 2.X
All the binaries will be builded in the directory notepad++\PowerEditor\bin
All the binaries will be built in the directory notepad++\PowerEditor\bin
Go to Notepad++ official site for more information :