From: Julian Smart Date: Tue, 21 Dec 2010 11:11:25 +0000 (+0000) Subject: Fixed bad rendering with tabs by correcting the position tabs are calculated from X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/925a662ab00361c64446e186b6d2876de4356a5d Fixed bad rendering with tabs by correcting the position tabs are calculated from git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@66420 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 621805fd25..924074a586 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -5117,7 +5117,7 @@ bool wxRichTextPlainText::DrawTabbedString(wxDC& dc, const wxRichTextAttr& attr, dc.SetBackgroundMode(wxBRUSHSTYLE_TRANSPARENT); } - wxCoord x_orig = x; + wxCoord x_orig = GetParent()->GetPosition().x; while (hasTabs) { // the string has a tab @@ -5216,6 +5216,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz wxRichTextParagraph* para = wxDynamicCast(GetParent(), wxRichTextParagraph); wxASSERT (para != NULL); + int relativeX = position.x - GetParent()->GetPosition().x; wxRichTextAttr textAttr(para ? para->GetCombinedAttributes(GetAttributes()) : GetAttributes()); @@ -5302,9 +5303,9 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz partialExtents->Add(oldWidth + p[j]); if (partialExtents->GetCount() > 0) - absoluteWidth = (*partialExtents)[(*partialExtents).GetCount()-1] + position.x; + absoluteWidth = (*partialExtents)[(*partialExtents).GetCount()-1] + relativeX; else - absoluteWidth = position.x; + absoluteWidth = relativeX; } else { @@ -5331,7 +5332,7 @@ bool wxRichTextPlainText::GetRangeSize(const wxRichTextRange& range, wxSize& siz } notFound = false; - width = nextTabPos - position.x; + width = nextTabPos - relativeX; if (partialExtents) partialExtents->Add(width);