X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/9c8e10ad37434a8801f2a5c3d4675cfddd61635d..6e42b980d934033794fb3be759c2eb77cf9c024f:/src/richtext/richtextbuffer.cpp diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 0135fa961f..1362fab709 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -4171,7 +4171,9 @@ bool wxRichTextParagraph::GetContiguousPlainText(wxString& text, const wxRichTex text += textObj->GetTextForRange(range); } else - return true; + { + text += wxT(" "); + } } node = node->GetNext(); @@ -4191,7 +4193,9 @@ bool wxRichTextParagraph::GetContiguousPlainText(wxString& text, const wxRichTex text = textObj->GetTextForRange(range) + text; } else - return true; + { + text = wxT(" ") + text; + } } node = node->GetPrevious(); @@ -5334,8 +5338,14 @@ bool wxRichTextBuffer::InsertNewlineWithUndo(long pos, wxRichTextCtrl* ctrl, int { if (para && para->GetRange().GetEnd() == pos) pos1 ++; + + // Now see if we need to number the paragraph. if (newPara->GetAttributes().HasBulletNumber()) - newPara->GetAttributes().SetBulletNumber(newPara->GetAttributes().GetBulletNumber()+1); + { + wxRichTextAttr numberingAttr; + if (FindNextParagraphNumber(para, numberingAttr)) + wxRichTextApplyStyle(newPara->GetAttributes(), (const wxRichTextAttr&) numberingAttr); + } } action->SetPosition(pos); @@ -5444,6 +5454,25 @@ wxTextAttr wxRichTextBuffer::GetStyleForNewParagraph(long pos, bool caretPositio } } } + + // Also apply list style if present + if (lookUpNewParaStyle && !para->GetAttributes().GetListStyleName().IsEmpty() && GetStyleSheet()) + { + wxRichTextListStyleDefinition* listDef = GetStyleSheet()->FindListStyle(para->GetAttributes().GetListStyleName()); + if (listDef) + { + int thisIndent = para->GetAttributes().GetLeftIndent(); + int thisLevel = para->GetAttributes().HasOutlineLevel() ? para->GetAttributes().GetOutlineLevel() : listDef->FindLevelForIndent(thisIndent); + + // Apply the overall list style, and item style for this level + wxRichTextAttr listStyle(listDef->GetCombinedStyleForLevel(thisLevel, GetStyleSheet())); + wxRichTextApplyStyle(attr, listStyle); + attr.SetOutlineLevel(thisLevel); + if (para->GetAttributes().HasBulletNumber()) + attr.SetBulletNumber(para->GetAttributes().GetBulletNumber()); + } + } + if (!foundAttributes) { attr = para->GetAttributes(); @@ -5456,14 +5485,6 @@ wxTextAttr wxRichTextBuffer::GetStyleForNewParagraph(long pos, bool caretPositio attr.SetFlags(flags); } - // Now see if we need to number the paragraph. - if (attr.HasBulletStyle()) - { - wxTextAttr numberingAttr; - if (FindNextParagraphNumber(para, numberingAttr)) - wxRichTextApplyStyle(attr, (const wxTextAttr&) numberingAttr); - } - return attr; } else