Fix search/replace deleting part of line following the last match on that line. Also a minor optimisation.

Originally committed to SVN as r2280.
This commit is contained in:
Niels Martin Hansen 2008-07-23 16:09:27 +00:00
parent 5d3b1fe8c2
commit 7342c2b617

View file

@ -481,8 +481,9 @@ void SearchReplaceEngine::ReplaceAll() {
// Normal replace
else {
if (!Search.matchCase) {
wxString Left, Right = *Text;
wxString Left = _T(""), Right = *Text;
int pos = 0;
Left.Alloc(Right.Len());
while (pos <= (int)(Right.Len() - LookFor.Len())) {
if (Right.Mid(pos, LookFor.Len()).CmpNoCase(LookFor) == 0) {
Left.Append(Right.Mid(0,pos)).Append(ReplaceWith);
@ -496,7 +497,7 @@ void SearchReplaceEngine::ReplaceAll() {
}
}
if (replaced) {
*Text = Left;
*Text = Left + Right;
}
}
else {