Fixed insertion point bug

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@43728 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2006-12-01 12:39:21 +00:00
parent 4e1d79d308
commit 46ee0e5bf8

View 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));