diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 1ec5fbef57..2f011a31fa 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -11492,10 +11492,10 @@ bool wxRichTextAction::Do() while (c) { if (c == container) - { m_ctrl->StoreFocusObject(container); - break; - } + + if (m_ctrl && (c == m_ctrl->GetSelection().GetContainer())) + m_ctrl->SelectNone(); c = c->GetParent(); } } @@ -11672,10 +11672,10 @@ bool wxRichTextAction::Undo() while (c) { if (c == container) - { m_ctrl->StoreFocusObject(container); - break; - } + + if (m_ctrl && (c == m_ctrl->GetSelection().GetContainer())) + m_ctrl->SelectNone(); c = c->GetParent(); } }