]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed centering and right-justification when combined with left indentation (bug...
authorJulian Smart <julian@anthemion.co.uk>
Fri, 28 Nov 2008 15:53:13 +0000 (15:53 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 28 Nov 2008 15:53:13 +0000 (15:53 +0000)
Fixed wrapping problem for long lines (bug #10149).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57002 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextbuffer.cpp

index eb0b15d417e825f685cd799d972e91a0f9029ded..80e5e8fd1bc35d8173c0b026c18037b1f6b48102 100644 (file)
@@ -3618,12 +3618,12 @@ void wxRichTextParagraph::ApplyParagraphStyle(const wxTextAttr& attr, const wxRe
         // centering, right-justification
         if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_CENTRE)
         {
-            pos.x = (rect.GetWidth() - size.x)/2 + pos.x;
+            pos.x = (rect.GetWidth() - (pos.x - rect.x) - size.x)/2 + pos.x;
             line->SetPosition(pos);
         }
         else if (attr.HasAlignment() && GetAttributes().GetAlignment() == wxTEXT_ALIGNMENT_RIGHT)
         {
-            pos.x = pos.x + rect.GetWidth() - size.x;
+            pos.x = rect.x + rect.GetWidth() - size.x;
             line->SetPosition(pos);
         }
 
@@ -4228,7 +4228,7 @@ bool wxRichTextParagraph::FindWrapPosition(const wxRichTextRange& range, wxDC& d
             widthBefore = 0;
 
         size_t i;
-        for (i = (size_t) range.GetStart(); i < (size_t) range.GetEnd(); i++)
+        for (i = (size_t) range.GetStart(); i= < (size_t) range.GetEnd(); i++)
         {
             int widthFromStartOfThisRange = (*partialExtents)[i - GetRange().GetStart()] - widthBefore;
 
@@ -5473,7 +5473,7 @@ wxTextAttr wxRichTextBuffer::GetStyleForNewParagraph(long pos, bool caretPositio
                 if (para->GetAttributes().HasBulletNumber())
                     attr.SetBulletNumber(para->GetAttributes().GetBulletNumber());
             }
-               }
+        }
 
         if (!foundAttributes)
         {