diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index f17f174c46..c223616445 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -1861,8 +1861,12 @@ bool wxRichTextParagraphLayoutBox::Draw(wxDC& dc, wxRichTextDrawingContext& cont AdjustAttributes(attr, context); int flags = style; - if (selection.IsValid() && GetParentContainer() != this && selection.GetContainer() == this && selection.WithinSelection(GetRange().GetStart(), GetParentContainer())) + if (selection.IsValid() && + ((GetParentContainer() != this && selection.GetContainer() == this && selection.WithinSelection(GetRange().GetStart(), GetParentContainer())) || + (selection.WithinSelection(GetRange().GetStart(), this)))) + { flags |= wxRICHTEXT_DRAW_SELECTED; + } // Don't draw guidelines if at top level int theseFlags = flags;