From d081739d4e1857cace594a43e653669b529ad41b Mon Sep 17 00:00:00 2001
From: Julian Smart <julian@anthemion.co.uk>
Date: Tue, 8 Apr 2008 11:05:00 +0000
Subject: [PATCH] Don't send event from ChangeValue

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@53090 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/richtext/richtextctrl.cpp | 18 ++++++++++++++++--
 1 file changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp
index 5df966700d..d18a1b35ae 100644
--- a/src/richtext/richtextctrl.cpp
+++ b/src/richtext/richtextctrl.cpp
@@ -2089,13 +2089,27 @@ wxString wxRichTextCtrl::GetRange(long from, long to) const
 
 void wxRichTextCtrl::DoSetValue(const wxString& value, int flags)
 {
-    Clear();
+    // Don't call Clear here, since it always sends a text updated event
+    m_buffer.ResetAndClearCommands();
+    m_buffer.SetDirty(true);
+    m_caretPosition = -1;
+    m_caretPositionForDefaultStyle = -2;
+    m_caretAtLineStart = false;
+    m_selectionRange.SetRange(-2, -2);
+
+    Scroll(0,0);
+
+    if (!IsFrozen())
+    {
+        LayoutContent();
+        Refresh(false);
+    }
 
     if (!value.IsEmpty())
     {
         // Remove empty paragraph
         GetBuffer().Clear();
-        DoWriteText(value);
+        DoWriteText(value, flags);
 
         // for compatibility, don't move the cursor when doing SetValue()
         SetInsertionPoint(0);
-- 
2.47.2