From: Vadim Zeitlin Date: Sun, 30 Sep 2012 22:27:21 +0000 (+0000) Subject: Fix wxStyledTextCtrl::WriteText() to replace the selection. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/933be2dc3947b4a89d3951e8b34379ecf0467220 Fix wxStyledTextCtrl::WriteText() to replace the selection. 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 --- diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 89c44a4cec..d53593a846 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -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, ""); diff --git a/src/stc/stc.h.in b/src/stc/stc.h.in index a10155c38b..d18af6b451 100644 --- a/src/stc/stc.h.in +++ b/src/stc/stc.h.in @@ -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, "");