Apply previous paragraph style if pasting plain text, but not if pasting rich text.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53505 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -5224,6 +5224,15 @@ bool wxRichTextBuffer::InsertParagraphsWithUndo(long pos, const wxRichTextParagr
|
||||
|
||||
action->GetNewParagraphs() = paragraphs;
|
||||
|
||||
if (p && !p->IsDefault())
|
||||
{
|
||||
for (wxRichTextObjectList::compatibility_iterator node = action->GetNewParagraphs().GetChildren().GetFirst(); node; node = node->GetNext())
|
||||
{
|
||||
wxRichTextObject* child = node->GetData();
|
||||
child->SetAttributes(*p);
|
||||
}
|
||||
}
|
||||
|
||||
action->SetPosition(pos);
|
||||
|
||||
wxRichTextRange range = wxRichTextRange(pos, pos + paragraphs.GetRange().GetEnd() - 1);
|
||||
@@ -6086,7 +6095,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
|
||||
wxRichTextBuffer* richTextBuffer = data.GetRichTextBuffer();
|
||||
if (richTextBuffer)
|
||||
{
|
||||
InsertParagraphsWithUndo(position+1, *richTextBuffer, GetRichTextCtrl(), wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
|
||||
InsertParagraphsWithUndo(position+1, *richTextBuffer, GetRichTextCtrl(), 0);
|
||||
if (GetRichTextCtrl())
|
||||
GetRichTextCtrl()->ShowPosition(position + richTextBuffer->GetRange().GetEnd());
|
||||
delete richTextBuffer;
|
||||
@@ -6110,7 +6119,7 @@ bool wxRichTextBuffer::PasteFromClipboard(long position)
|
||||
#else
|
||||
wxString text2 = text;
|
||||
#endif
|
||||
InsertTextWithUndo(position+1, text2, GetRichTextCtrl());
|
||||
InsertTextWithUndo(position+1, text2, GetRichTextCtrl(), wxRICHTEXT_INSERT_WITH_PREVIOUS_PARAGRAPH_STYLE);
|
||||
|
||||
if (GetRichTextCtrl())
|
||||
GetRichTextCtrl()->ShowPosition(position + text2.Length());
|
||||
|
Reference in New Issue
Block a user