From: Julian Smart Date: Fri, 1 Dec 2006 12:39:21 +0000 (+0000) Subject: Fixed insertion point bug X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/46ee0e5bf81bec02a722fc1cd75842daaa7b630f Fixed insertion point bug git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 6388b00489..949d375ced 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -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));