]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed insertion point bug
authorJulian Smart <julian@anthemion.co.uk>
Fri, 1 Dec 2006 12:39:21 +0000 (12:39 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 1 Dec 2006 12:39:21 +0000 (12:39 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextbuffer.cpp

index 6388b00489d65adf9ba650610cf649bfc59995bf..949d375ced59ed1b5c6b9465a1967bcd0d3bf96d 100644 (file)
@@ -4745,6 +4745,8 @@ bool wxRichTextBuffer::InsertTextWithUndo(long pos, const wxString& text, wxRich
         length --;
         action->GetNewParagraphs().SetPartialParagraph(true);
     }
+    else if (text.length() > 0 && text.Last() == wxT('\n'))
+        length --;
 
     action->SetPosition(pos);
 
@@ -6038,6 +6040,13 @@ bool wxRichTextAction::Do()
             // Don't take into account the last newline
             if (m_newParagraphs.GetPartialParagraph())
                 newCaretPosition --;
+            else
+                if (m_newParagraphs.GetChildren().GetCount() > 0)
+                {
+                    wxRichTextObject* p = (wxRichTextObject*) m_newParagraphs.GetChildren().GetLast()->GetData();
+                    if (p->GetRange().GetLength() == 1)
+                        newCaretPosition --;
+                }
 
             newCaretPosition = wxMin(newCaretPosition, (m_buffer->GetRange().GetEnd()-1));