From b402ac436c6d8eb107f4590f38b0e4b88233b934 Mon Sep 17 00:00:00 2001 From: Julian Smart Date: Wed, 13 Feb 2008 16:27:49 +0000 Subject: [PATCH] Fixed undo batching git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@51756 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- src/richtext/richtextbuffer.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index e25cc6dc9a..34aec251a3 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -5136,7 +5136,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); } @@ -5156,7 +5156,7 @@ bool wxRichTextBuffer::EndBatchUndo() if (m_batchedCommandDepth == 0) { - GetCommandProcessor()->Submit(m_batchedCommand); + GetCommandProcessor()->Store(m_batchedCommand); m_batchedCommand = NULL; } @@ -5167,7 +5167,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());