diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 3c6724929b..66e81f224d 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -11798,10 +11798,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(); } } @@ -11979,10 +11979,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(); } }