From cc30ea496113197425dea85309c1c5fc676076ef Mon Sep 17 00:00:00 2001 From: "Zane U. Ji" Date: Sat, 11 Aug 2012 08:33:17 +0800 Subject: [PATCH] Undo a replace all action correctly (Bug #2825280) --- src/xmlcopyeditor.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/xmlcopyeditor.cpp b/src/xmlcopyeditor.cpp index e538a19..e7a8b28 100755 --- a/src/xmlcopyeditor.cpp +++ b/src/xmlcopyeditor.cpp @@ -1908,6 +1908,8 @@ void MyFrame::OnDialogReplaceAll ( wxFindDialogEvent& event ) doc->SetTargetEnd ( doc->GetLength() ); doc->SetSearchFlags ( flags ); + doc->BeginUndoAction(); + int newLocation, replacementCount, regexWidth; newLocation = replacementCount = regexWidth = 0; @@ -1926,8 +1928,10 @@ void MyFrame::OnDialogReplaceAll ( wxFindDialogEvent& event ) doc->SetTargetEnd ( doc->GetLength() ); ++replacementCount; } - wxString msg; + doc->EndUndoAction(); + + wxString msg; msg.Printf ( ngettext ( L"%i replacement made", L"%i replacements made", replacementCount ), replacementCount );