Ensure paragraph properties are preserved when inserting a fragment in wxRTC
This commit is contained in:
@@ -2881,6 +2881,7 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag
|
|||||||
if (para)
|
if (para)
|
||||||
{
|
{
|
||||||
wxRichTextAttr originalAttr = para->GetAttributes();
|
wxRichTextAttr originalAttr = para->GetAttributes();
|
||||||
|
wxRichTextProperties originalProperties = para->GetProperties();
|
||||||
|
|
||||||
wxRichTextObjectList::compatibility_iterator node = m_children.Find(para);
|
wxRichTextObjectList::compatibility_iterator node = m_children.Find(para);
|
||||||
|
|
||||||
@@ -2950,7 +2951,10 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag
|
|||||||
wxASSERT(firstPara != NULL);
|
wxASSERT(firstPara != NULL);
|
||||||
|
|
||||||
if (!(fragment.GetAttributes().GetFlags() & wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE))
|
if (!(fragment.GetAttributes().GetFlags() & wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE))
|
||||||
|
{
|
||||||
para->SetAttributes(firstPara->GetAttributes());
|
para->SetAttributes(firstPara->GetAttributes());
|
||||||
|
para->SetProperties(firstPara->GetProperties());
|
||||||
|
}
|
||||||
|
|
||||||
// Save empty paragraph attributes for appending later
|
// Save empty paragraph attributes for appending later
|
||||||
// These are character attributes deliberately set for a new paragraph. Without this,
|
// These are character attributes deliberately set for a new paragraph. Without this,
|
||||||
@@ -3028,9 +3032,15 @@ bool wxRichTextParagraphLayoutBox::InsertFragment(long position, wxRichTextParag
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ((fragment.GetAttributes().GetFlags() & wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE) && firstPara)
|
if ((fragment.GetAttributes().GetFlags() & wxTEXT_ATTR_KEEP_FIRST_PARA_STYLE) && firstPara)
|
||||||
|
{
|
||||||
finalPara->SetAttributes(firstPara->GetAttributes());
|
finalPara->SetAttributes(firstPara->GetAttributes());
|
||||||
|
finalPara->SetProperties(firstPara->GetProperties());
|
||||||
|
}
|
||||||
else if (finalPara && finalPara != para)
|
else if (finalPara && finalPara != para)
|
||||||
|
{
|
||||||
finalPara->SetAttributes(originalAttr);
|
finalPara->SetAttributes(originalAttr);
|
||||||
|
finalPara->SetProperties(originalProperties);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user