]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextbuffer.cpp
Fixed a style application bug inserting a newline other than after the end of a parag...
[wxWidgets.git] / src / richtext / richtextbuffer.cpp
index dc5a7640319289b2a65b10138c410e69af8d3473..3f69ec35f66a12b0cc79ff7235834962826be45d 100644 (file)
@@ -4813,7 +4813,8 @@ wxTextAttr wxRichTextBuffer::GetStyleForNewParagraph(long pos, bool caretPositio
             wxRichTextParagraphStyleDefinition* paraDef = GetStyleSheet()->FindParagraphStyle(para->GetAttributes().GetParagraphStyleName());
             if (paraDef)
             {
-                if (!paraDef->GetNextStyle().IsEmpty())
+                // If we're not at the end of the paragraph, then we apply THIS style, and not the designated next style.
+                if (para->GetRange().GetEnd() == pos && !paraDef->GetNextStyle().IsEmpty())
                 {
                     wxRichTextParagraphStyleDefinition* nextParaDef = GetStyleSheet()->FindParagraphStyle(paraDef->GetNextStyle());
                     if (nextParaDef)