mirror of
https://github.com/odrling/Aegisub
synced 2025-04-11 22:56:02 +02:00
Fix #684, I hope. Redid the case-insensitive Replace All algorithm to replace from a Right side into a Left side, also avoiding use of wx 1.x compatibility functions and doing proper case-insensitive compares rather than searching a lowercased string for a lowercased substring.
Originally committed to SVN as r2204.
This commit is contained in:
parent
b9d8f72838
commit
59a5e8f3b3
@ -480,14 +480,22 @@ void SearchReplaceEngine::ReplaceAll() {
|
|||||||
// Normal replace
|
// Normal replace
|
||||||
else {
|
else {
|
||||||
if (!Search.matchCase) {
|
if (!Search.matchCase) {
|
||||||
wxString Left, Right;
|
wxString Left, Right = *Text;
|
||||||
int pos;
|
int pos = 0;
|
||||||
while(Text->Lower().Contains(LookFor.Lower())) {
|
while (pos <= (int)(Right.Len() - LookFor.Len())) {
|
||||||
pos = Text->Lower().Find(LookFor.Lower());
|
if (Right.Mid(pos, LookFor.Len()).CmpNoCase(LookFor) == 0) {
|
||||||
Left = pos ? Text->Left(pos) : _T("");
|
Left.Append(Right.Mid(0,pos)).Append(ReplaceWith);
|
||||||
Right = Text->Mid(pos+LookFor.Len());
|
Right = Right.Mid(pos+LookFor.Len());
|
||||||
*Text = Left + ReplaceWith + Right;
|
|
||||||
count++;
|
count++;
|
||||||
|
replaced = true;
|
||||||
|
pos = 0;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
pos++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (replaced) {
|
||||||
|
*Text = Left;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -502,7 +510,6 @@ void SearchReplaceEngine::ReplaceAll() {
|
|||||||
if (replaced) {
|
if (replaced) {
|
||||||
AssDialogue *cur = grid->GetDialogue(i);
|
AssDialogue *cur = grid->GetDialogue(i);
|
||||||
cur->UpdateData();
|
cur->UpdateData();
|
||||||
//cur->ParseASSTags();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user