diff --git a/src/richtext/richtextbuffer.cpp b/src/richtext/richtextbuffer.cpp index 19e715b321..6b0b8acfb5 100644 --- a/src/richtext/richtextbuffer.cpp +++ b/src/richtext/richtextbuffer.cpp @@ -5894,8 +5894,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); @@ -6003,6 +6009,25 @@ wxRichTextAttr wxRichTextBuffer::GetStyleForNewParagraph(long pos, bool caretPos } } } + + // 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 + wxTextAttrEx 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(); @@ -6015,14 +6040,6 @@ wxRichTextAttr wxRichTextBuffer::GetStyleForNewParagraph(long pos, bool caretPos attr.SetFlags(flags); } - // Now see if we need to number the paragraph. - if (attr.HasBulletStyle()) - { - wxRichTextAttr numberingAttr; - if (FindNextParagraphNumber(para, numberingAttr)) - wxRichTextApplyStyle(attr, (const wxRichTextAttr&) numberingAttr); - } - return attr; } else diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index df1bad6905..cbc56d2f5a 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -1091,6 +1091,9 @@ bool wxRichTextCtrl::ExtendSelection(long oldPos, long newPos, int flags) { if (flags & wxRICHTEXT_SHIFT_DOWN) { + if (oldPos == newPos) + return false; + wxRichTextRange oldSelection = m_selectionRange; // If not currently selecting, start selecting @@ -1109,6 +1112,8 @@ bool wxRichTextCtrl::ExtendSelection(long oldPos, long newPos, int flags) // the end. if (newPos > m_selectionAnchor) m_selectionRange.SetRange(m_selectionAnchor+1, newPos); + else if (newPos == m_selectionAnchor) + m_selectionRange = wxRichTextRange(-2, -2); else m_selectionRange.SetRange(newPos+1, m_selectionAnchor); }