]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextctrl.cpp
Implement undo and redo for the ie and gtk webkit backends. Extend the sample to...
[wxWidgets.git] / src / richtext / richtextctrl.cpp
index cbe4d43fc8b06a0dd476f22f699485953e36ae7c..c95805f58a4fbf097aa3ba7742d29331da82ee12 100644 (file)
@@ -1,5 +1,5 @@
 /////////////////////////////////////////////////////////////////////////////
-// Name:        src/richtext/richeditctrl.cpp
+// Name:        src/richtext/richtextctrl.cpp
 // Purpose:     A rich edit control
 // Author:      Julian Smart
 // Modified by:
@@ -1221,6 +1221,7 @@ void wxRichTextCtrl::OnChar(wxKeyEvent& event)
                 SetDefaultStyleToCursorStyle();
                 ScrollIntoView(m_caretPosition, WXK_RIGHT);
 
+                cmdEvent.SetPosition(m_caretPosition);
                 GetEventHandler()->ProcessEvent(cmdEvent);
 
                 Update();
@@ -1568,7 +1569,7 @@ bool wxRichTextCtrl::IsPositionVisible(long pos) const
     wxSize clientSize = GetClientSize();
     clientSize.y -= GetBuffer().GetBottomMargin();
 
-    return (rect.GetBottom() > (startY + GetBuffer().GetTopMargin())) && (rect.GetTop() < (startY + clientSize.y));
+    return (rect.GetTop() >= (startY + GetBuffer().GetTopMargin())) && (rect.GetBottom() <= (startY + clientSize.y));
 }
 
 void wxRichTextCtrl::SetCaretPosition(long position, bool showAtLineStart)
@@ -2203,6 +2204,19 @@ void wxRichTextCtrl::OnSize(wxSizeEvent& event)
     event.Skip();
 }
 
+// Force any pending layout due to large buffer
+void wxRichTextCtrl::ForceDelayedLayout()
+{
+    if (m_fullLayoutRequired)
+    {
+        m_fullLayoutRequired = false;
+        m_fullLayoutTime = 0;
+        GetBuffer().Invalidate(wxRICHTEXT_ALL);
+        ShowPosition(m_fullLayoutSavedPosition);
+        Refresh(false);
+        Update();
+    }
+}
 
 /// Idle-time processing
 void wxRichTextCtrl::OnIdle(wxIdleEvent& event)