Two bug fixes for FindWrapPosition
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53308 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -4022,6 +4022,9 @@ bool wxRichTextParagraph::GetContiguousPlainText(wxString& text, const wxRichTex
|
|||||||
/// Find a suitable wrap position.
|
/// Find a suitable wrap position.
|
||||||
bool wxRichTextParagraph::FindWrapPosition(const wxRichTextRange& range, wxDC& dc, int availableSpace, long& wrapPosition, wxArrayInt* partialExtents)
|
bool wxRichTextParagraph::FindWrapPosition(const wxRichTextRange& range, wxDC& dc, int availableSpace, long& wrapPosition, wxArrayInt* partialExtents)
|
||||||
{
|
{
|
||||||
|
if (range.GetLength() <= 0)
|
||||||
|
return false;
|
||||||
|
|
||||||
// Find the first position where the line exceeds the available space.
|
// Find the first position where the line exceeds the available space.
|
||||||
wxSize sz;
|
wxSize sz;
|
||||||
long breakPosition = range.GetEnd();
|
long breakPosition = range.GetEnd();
|
||||||
@@ -4041,7 +4044,7 @@ bool wxRichTextParagraph::FindWrapPosition(const wxRichTextRange& range, wxDC& d
|
|||||||
{
|
{
|
||||||
int widthFromStartOfThisRange = (*partialExtents)[i - GetRange().GetStart()] - widthBefore;
|
int widthFromStartOfThisRange = (*partialExtents)[i - GetRange().GetStart()] - widthBefore;
|
||||||
|
|
||||||
if (widthFromStartOfThisRange >= availableSpace)
|
if (widthFromStartOfThisRange > availableSpace)
|
||||||
{
|
{
|
||||||
breakPosition = i-1;
|
breakPosition = i-1;
|
||||||
break;
|
break;
|
||||||
|
Reference in New Issue
Block a user