+ wxRichTextParagraph* lastPara = wxDynamicCast(fragment.GetChildren().GetLast()->GetData(), wxRichTextParagraph);
+ wxASSERT( lastPara != NULL );
+
+ if (!firstPara || !lastPara)
+ return false;
+
+ bool isFragment = (range.GetEnd() < lastPara->GetRange().GetEnd());
+
+ long firstPos = firstPara->GetRange().GetStart();
+
+ // Adjust for renumbering from zero
+ wxRichTextRange topTailRange(range.GetStart() - firstPos, range.GetEnd() - firstPos);
+
+ long end;
+ fragment.CalculateRange(0, end);
+