]> git.saurik.com Git - wxWidgets.git/commitdiff
Don't reset URL if applying character style
authorJulian Smart <julian@anthemion.co.uk>
Fri, 5 Apr 2013 15:54:49 +0000 (15:54 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 5 Apr 2013 15:54:49 +0000 (15:54 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@73785 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextbuffer.cpp

index 217e41e663b8ded80ad125d748fb3a60c8752791..1a6186778fb4eb69460db7737a46689942ea6c5b 100644 (file)
@@ -3318,7 +3318,17 @@ bool wxRichTextParagraphLayoutBox::SetStyle(const wxRichTextRange& range, const
                             wxRichTextRemoveStyle(child->GetAttributes(), style);
                         }
                         else if (resetExistingStyle)
+                        {
+                            // Preserve the URL as it's not really a formatting style but a property of the object
+                            wxString url;
+                            if (child->GetAttributes().HasURL() && !characterAttributes.HasURL())
+                                url = child->GetAttributes().GetURL();
+
                             child->GetAttributes() = characterAttributes;
+
+                            if (!url.IsEmpty())
+                                child->GetAttributes().SetURL(url);
+                        }
                         else
                         {
                             if (applyMinimal)