Bug fix for empty objects
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53384 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -3206,7 +3206,7 @@ bool wxRichTextParagraph::Draw(wxDC& dc, const wxRichTextRange& range, const wxR
|
||||
{
|
||||
wxRichTextObject* child = node2->GetData();
|
||||
|
||||
if (!child->GetRange().IsOutside(lineRange) && !lineRange.IsOutside(range))
|
||||
if (child->GetRange().GetLength() > 0 && !child->GetRange().IsOutside(lineRange) && !lineRange.IsOutside(range))
|
||||
{
|
||||
// Draw this part of the line at the correct position
|
||||
wxRichTextRange objectRange(child->GetRange());
|
||||
@@ -3251,6 +3251,9 @@ static int wxRichTextGetRangeWidth(const wxRichTextParagraph& para, const wxRich
|
||||
{
|
||||
wxASSERT(partialExtents.GetCount() >= (size_t) range.GetLength());
|
||||
|
||||
if (partialExtents.GetCount() < (size_t) range.GetLength())
|
||||
return 0;
|
||||
|
||||
int leftMostPos = 0;
|
||||
if (range.GetStart() - para.GetRange().GetStart() > 0)
|
||||
leftMostPos = partialExtents[range.GetStart() - para.GetRange().GetStart() - 1];
|
||||
@@ -3353,6 +3356,12 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style)
|
||||
{
|
||||
wxRichTextObject* child = node->GetData();
|
||||
|
||||
if (child->GetRange().GetLength() == 0)
|
||||
{
|
||||
node = node->GetNext();
|
||||
continue;
|
||||
}
|
||||
|
||||
// If this is e.g. a composite text box, it will need to be laid out itself.
|
||||
// But if just a text fragment or image, for example, this will
|
||||
// do nothing. NB: won't we need to set the position after layout?
|
||||
@@ -3542,7 +3551,7 @@ bool wxRichTextParagraph::Layout(wxDC& dc, const wxRect& rect, int style)
|
||||
{
|
||||
wxRichTextObject* child = node2->GetData();
|
||||
|
||||
if (!child->GetRange().IsOutside(lineRange))
|
||||
if (child->GetRange().GetLength() > 0 && !child->GetRange().IsOutside(lineRange))
|
||||
{
|
||||
wxRichTextRange rangeToUse = lineRange;
|
||||
rangeToUse.LimitTo(child->GetRange());
|
||||
|
Reference in New Issue
Block a user