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
This commit is contained in:
Vadim Zeitlin 2012-09-30 22:27:21 +00:00
parent 0015757fec
commit 933be2dc39
2 changed files with 10 additions and 2 deletions

View 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, "");

View 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, "");