[BUG_FIXED] (Author: Dave Brotherstone) Fix replacing '\n' bug in both extended and regex mode.

git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@1029 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
Don Ho 2013-03-06 01:35:48 +00:00
parent d6ea29c577
commit 385c4c1f41

View File

@ -1189,16 +1189,16 @@ bool FindReplaceDlg::processFindNext(const TCHAR *txt2find, const FindOption *op
int start, end;
int posFind;
(*_ppEditView)->execute(SCI_SETSEARCHFLAGS, flags);
// Don't allow a search to start in the middle of a line end marker
// Never allow a zero length match in the middle of a line end marker
if ((*_ppEditView)->execute(SCI_GETCHARAT, startPosition - 1) == '\r'
&& (*_ppEditView)->execute(SCI_GETCHARAT, startPosition) == '\n')
{
++startPosition;
flags = (flags & ~SCFIND_REGEXP_EMPTYMATCH_MASK) | SCFIND_REGEXP_EMPTYMATCH_NONE;
}
(*_ppEditView)->execute(SCI_SETSEARCHFLAGS, flags);
posFind = (*_ppEditView)->searchInTarget(pText, stringSizeFind, startPosition, endPosition);
if (posFind == -1) //no match found in target, check if a new target should be used
{
@ -1329,6 +1329,10 @@ bool FindReplaceDlg::processReplace(const TCHAR *txt2find, const TCHAR *txt2repl
}
else
{
if (replaceOptions._searchType == FindExtended)
{
Searching::convertExtendedToString(pTextReplace, pTextReplace, stringSizeReplace);
}
replacedLen = (*_ppEditView)->replaceTarget(pTextReplace);
}