X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/648d8a8720f1f240224be32bbfcfd9f9f88a7244..77a1771911ed222ba6861ead327c3735fc16a0b1:/src/richtext/richtextbuffer.cpp diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index dd30e8ce1a..3f714632a4 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -567,7 +567,9 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, const wxRect& rect, int styl if (firstParagraph) { wxRichTextObjectList::compatibility_iterator firstNode = m_children.Find(firstParagraph); - wxRichTextObjectList::compatibility_iterator previousNode = firstNode ? firstNode->GetPrevious() : wxRichTextObjectList::compatibility_iterator(); + wxRichTextObjectList::compatibility_iterator previousNode; + if ( firstNode ) + previousNode = firstNode->GetPrevious(); if (firstNode && previousNode) { wxRichTextParagraph* previousParagraph = wxDynamicCast(previousNode->GetData(), wxRichTextParagraph); @@ -589,10 +591,13 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, const wxRect& rect, int styl // Assume this box only contains paragraphs wxRichTextParagraph* child = wxDynamicCast(node->GetData(), wxRichTextParagraph); - wxASSERT (child != NULL); + wxCHECK_MSG( child, false, _T("Unknown object in layout") ); // TODO: what if the child hasn't been laid out (e.g. involved in Undo) but still has 'old' lines - if (child && !forceQuickLayout && (layoutAll || child->GetLines().GetCount() == 0 || !child->GetRange().IsOutside(invalidRange))) + if ( !forceQuickLayout && + (layoutAll || + child->GetLines().IsEmpty() || + !child->GetRange().IsOutside(invalidRange)) ) { child->Layout(dc, availableSpace, style); @@ -3849,6 +3854,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position) wxTextDataObject data; wxTheClipboard->GetData(data); wxString text(data.GetText()); + text.Replace(_T("\r\n"), _T("\n")); InsertTextWithUndo(position+1, text, GetRichTextCtrl());