]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed undo batching
authorJulian Smart <julian@anthemion.co.uk>
Wed, 13 Feb 2008 16:28:00 +0000 (16:28 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Wed, 13 Feb 2008 16:28:00 +0000 (16:28 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51757 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextbuffer.cpp

index 4ee7357eeabfc39461f33b800e191da4f167e1f9..ae5b2c223b425b069b27bf0b619fba77144fbcac 100644 (file)
@@ -5091,7 +5091,7 @@ bool wxRichTextBuffer::BeginBatchUndo(const wxString& cmdName)
         wxASSERT(m_batchedCommand == NULL);
         if (m_batchedCommand)
         {
-            GetCommandProcessor()->Submit(m_batchedCommand);
+            GetCommandProcessor()->Store(m_batchedCommand);
         }
         m_batchedCommand = new wxRichTextCommand(cmdName);
     }
@@ -5111,7 +5111,7 @@ bool wxRichTextBuffer::EndBatchUndo()
 
     if (m_batchedCommandDepth == 0)
     {
-        GetCommandProcessor()->Submit(m_batchedCommand);
+        GetCommandProcessor()->Store(m_batchedCommand);
         m_batchedCommand = NULL;
     }
 
@@ -5122,7 +5122,15 @@ bool wxRichTextBuffer::EndBatchUndo()
 bool wxRichTextBuffer::SubmitAction(wxRichTextAction* action)
 {
     if (BatchingUndo() && m_batchedCommand && !SuppressingUndo())
+    {
+        wxRichTextCommand* cmd = new wxRichTextCommand(action->GetName());
+        cmd->AddAction(action);
+        cmd->Do();
+        cmd->GetActions().Clear();
+        delete cmd;
+
         m_batchedCommand->AddAction(action);
+    }
     else
     {
         wxRichTextCommand* cmd = new wxRichTextCommand(action->GetName());