]> git.saurik.com Git - wxWidgets.git/commitdiff
Fixed Replace() to use the passed range instead of current selection
authorJulian Smart <julian@anthemion.co.uk>
Fri, 22 Jul 2011 13:07:40 +0000 (13:07 +0000)
committerJulian Smart <julian@anthemion.co.uk>
Fri, 22 Jul 2011 13:07:40 +0000 (13:07 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@68329 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/richtext/richtextctrl.cpp

index baf346df1ca4e5d4a70e587857fb0ba7f86f6bbf..f5039443c53ca55def1aacda60d6fd5128189d2d 100644 (file)
@@ -2925,13 +2925,19 @@ void wxRichTextCtrl::SetSelection(long from, long to)
 // Editing
 // ----------------------------------------------------------------------------
 
-void wxRichTextCtrl::Replace(long WXUNUSED(from), long WXUNUSED(to),
+void wxRichTextCtrl::Replace(long from, long to,
                              const wxString& value)
 {
     BeginBatchUndo(_("Replace"));
 
+    SetSelection(from, to);
+
+    wxRichTextAttr attr = GetDefaultStyle();
+
     DeleteSelectedContent();
 
+    SetDefaultStyle(attr);
+
     DoWriteText(value, SetValue_SelectionOnly);
 
     EndBatchUndo();