Browse Source

[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
remotes/trunk
Don Ho 12 years ago
parent
commit
385c4c1f41
  1. 14
      PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp

14
PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp

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

Loading…
Cancel
Save