diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 182f791719..039707a801 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -1766,7 +1766,7 @@ bool wxRichTextParagraphLayoutBox::SetStyle(const wxRichTextRange& range, const splitPoint ++; // Find last object - if (splitPoint == newPara->GetRange().GetEnd() || splitPoint == (newPara->GetRange().GetEnd() - 1)) + if (splitPoint == newPara->GetRange().GetEnd()) lastObject = newPara->GetChildren().GetLast()->GetData(); else // lastObject is set as a side-effect of splitting. It's diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index 885a055858..1fe67c49ce 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -2339,7 +2339,7 @@ void wxRichTextCtrl::Remove(long from, long to) { SelectNone(); - GetBuffer().DeleteRangeWithUndo(wxRichTextRange(from, to), this); + GetBuffer().DeleteRangeWithUndo(wxRichTextRange(from, to-1), this); LayoutContent(); if (!IsFrozen())