]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed bug in optimization for character input, affecting first paragraph in the buffer.
authorJulian Smart <julian@anthemion.co.uk>
Thu, 25 Oct 2007 16:13:47 +0000 (16:13 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Thu, 25 Oct 2007 16:13:47 +0000 (16:13 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@49436 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextbuffer.cpp

index c8547b38a2b351f23e45f951c6862ad4c357fbfb..de36d33ceb80a5eec36422c964265291a47e88b7 100644 (file)
@@ -595,7 +595,7 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, const wxRect& rect, int styl
     if (invalidRange == wxRICHTEXT_ALL)
         layoutAll = true;
     else    // If we know what range is affected, start laying out from that point on.
-        if (invalidRange.GetStart() > GetRange().GetStart())
+        if (invalidRange.GetStart() >= GetRange().GetStart())
     {
         wxRichTextParagraph* firstParagraph = GetParagraphAtPosition(invalidRange.GetStart());
         if (firstParagraph)
@@ -604,10 +604,13 @@ bool wxRichTextParagraphLayoutBox::Layout(wxDC& dc, const wxRect& rect, int styl
             wxRichTextObjectList::compatibility_iterator previousNode;
             if ( firstNode )
                 previousNode = firstNode->GetPrevious();
-            if (firstNode && previousNode)
+            if (firstNode)
             {
-                wxRichTextParagraph* previousParagraph = wxDynamicCast(previousNode->GetData(), wxRichTextParagraph);
-                availableSpace.y = previousParagraph->GetPosition().y + previousParagraph->GetCachedSize().y;
+                if (previousNode)
+                {
+                    wxRichTextParagraph* previousParagraph = wxDynamicCast(previousNode->GetData(), wxRichTextParagraph);
+                    availableSpace.y = previousParagraph->GetPosition().y + previousParagraph->GetCachedSize().y;
+                }
 
                 // Now we're going to start iterating from the first affected paragraph.
                 node = firstNode;