]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextctrl.cpp
need to include wx/msw/private.h to get GetHwnd() which is used here
[wxWidgets.git] / src / richtext / richtextctrl.cpp
index c59cbfb85192290c17a4a53f8cfdf3b9c357a2e3..ae7de5772277316d46b13917d6f07560f1c65c08 100644 (file)
@@ -128,6 +128,7 @@ bool wxRichTextCtrl::Create( wxWindow* parent, wxWindowID id, const wxString& va
         SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
     }
 
+    GetBuffer().Reset();
     GetBuffer().SetRichTextCtrl(this);
 
     if (style & wxTE_READONLY)
@@ -220,7 +221,7 @@ void wxRichTextCtrl::Thaw()
 /// Clear all text
 void wxRichTextCtrl::Clear()
 {
-    m_buffer.Reset();
+    m_buffer.ResetAndClearCommands();
     m_buffer.SetDirty(true);
     m_caretPosition = -1;
     m_caretPositionForDefaultStyle = -2;
@@ -553,6 +554,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
             
             GetEventHandler()->ProcessEvent(textEvent);
         }
+        Update();
     }
     else if (event.GetKeyCode() == WXK_BACK)
     {
@@ -572,7 +574,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
 
         EndBatchUndo();
 
-        // Shouldn't this be in Do()?
         if (GetLastPosition() == -1)
         {
             GetBuffer().Reset();
@@ -583,6 +584,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
         }
 
         ScrollIntoView(m_caretPosition, WXK_LEFT);
+        Update();
     }
     else if (event.GetKeyCode() == WXK_DELETE)
     {
@@ -601,7 +603,6 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
 
         EndBatchUndo();
 
-        // Shouldn't this be in Do()?
         if (GetLastPosition() == -1)
         {
             GetBuffer().Reset();
@@ -610,6 +611,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
             PositionCaret();
             SetDefaultStyleToCursorStyle();
         }
+        Update();
     }
     else
     {
@@ -758,6 +760,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
 
                 SetDefaultStyleToCursorStyle();
                 ScrollIntoView(m_caretPosition, WXK_RIGHT);
+                Update();
             }
         }
     }