From 385c4c1f41b324b959d2196c3efbbf796f8bd6c9 Mon Sep 17 00:00:00 2001 From: Don Ho Date: Wed, 6 Mar 2013 01:35:48 +0000 Subject: [PATCH] [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 --- .../src/ScitillaComponent/FindReplaceDlg.cpp | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp index 37d36d16..f66a8b7a 100644 --- a/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp +++ b/PowerEditor/src/ScitillaComponent/FindReplaceDlg.cpp @@ -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); }