]> git.saurik.com Git - wxWidgets.git/commitdiff
Fix wxStyledTextCtrl::WriteText() to replace the selection.
authorVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Sep 2012 22:27:21 +0000 (22:27 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Sun, 30 Sep 2012 22:27:21 +0000 (22:27 +0000)
WriteText() must replace the selection, not just insert the new text,
otherwise SetValue() implementation inherited from the base class doesn't work
as it doesn't clear the old contents of the control before adding new text to
it.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@72594 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/stc/stc.h
src/stc/stc.h.in

index 89c44a4cec1a6cd0e6085f0fe1cfef99d80eb2c3..d53593a846f8fd7d566ede45ec71d21bf5e76a9c 100644 (file)
@@ -4546,7 +4546,11 @@ public:
     // implement wxTextEntryBase pure virtual methods
     // ----------------------------------------------
 
-    virtual void WriteText(const wxString& text) { AddText(text); }
+    virtual void WriteText(const wxString& text)
+    {
+        ReplaceSelection(text);
+    }
+
     virtual void Remove(long from, long to)
     {
         Replace(from, to, "");
index a10155c38b521525d6ef7f29d74f75eb12fc20b8..d18af6b451eea17827da0e57fd264b93cd7532d7 100644 (file)
@@ -288,7 +288,11 @@ public:
     // implement wxTextEntryBase pure virtual methods
     // ----------------------------------------------
 
-    virtual void WriteText(const wxString& text) { AddText(text); }
+    virtual void WriteText(const wxString& text)
+    {
+        ReplaceSelection(text);
+    }
+
     virtual void Remove(long from, long to)
     {
         Replace(from, to, "");