mirror of https://github.com/odrling/Aegisub
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:
parent
5d3b1fe8c2
commit
7342c2b617
|
@ -481,8 +481,9 @@ void SearchReplaceEngine::ReplaceAll() {
|
||||||
// Normal replace
|
// Normal replace
|
||||||
else {
|
else {
|
||||||
if (!Search.matchCase) {
|
if (!Search.matchCase) {
|
||||||
wxString Left, Right = *Text;
|
wxString Left = _T(""), Right = *Text;
|
||||||
int pos = 0;
|
int pos = 0;
|
||||||
|
Left.Alloc(Right.Len());
|
||||||
while (pos <= (int)(Right.Len() - LookFor.Len())) {
|
while (pos <= (int)(Right.Len() - LookFor.Len())) {
|
||||||
if (Right.Mid(pos, LookFor.Len()).CmpNoCase(LookFor) == 0) {
|
if (Right.Mid(pos, LookFor.Len()).CmpNoCase(LookFor) == 0) {
|
||||||
Left.Append(Right.Mid(0,pos)).Append(ReplaceWith);
|
Left.Append(Right.Mid(0,pos)).Append(ReplaceWith);
|
||||||
|
@ -496,7 +497,7 @@ void SearchReplaceEngine::ReplaceAll() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (replaced) {
|
if (replaced) {
|
||||||
*Text = Left;
|
*Text = Left + Right;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
Loading…
Reference in New Issue