]> git.saurik.com Git - wxWidgets.git/blobdiff - src/richtext/richtextctrl.cpp
make sure 10.4 command-key events are routed via the wx-accelerator route as well...
[wxWidgets.git] / src / richtext / richtextctrl.cpp
index bbd792f9a441b11abb2bf94c8c1392f8ab994ba8..14266aa8c1a72e1bae62b86afd032040bd6ed87d 100644 (file)
@@ -1568,7 +1568,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)
@@ -1799,14 +1799,14 @@ bool wxRichTextCtrl::MoveDown(int noLines, int flags)
     }
 
     wxRichTextParagraphLayoutBox* container = GetFocusObject();
-    int hitTestFlags = wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS;
+    int hitTestFlags = wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS|wxRICHTEXT_HITTEST_NO_FLOATING_OBJECTS;
 
     if (notInThisObject)
     {
         // If we know we're navigating out of the current object,
         // try to find an object anywhere in the buffer at the new position (up or down a bit)
         container = & GetBuffer();
-        hitTestFlags = 0;
+        hitTestFlags &= ~wxRICHTEXT_HITTEST_NO_NESTED_OBJECTS;
 
         if (noLines > 0) // going down
         {
@@ -1835,7 +1835,10 @@ bool wxRichTextCtrl::MoveDown(int noLines, int flags)
     wxRichTextObject* contextObj = NULL;
     int hitTest = container->HitTest(dc, pt, newPos, & hitObj, & contextObj, hitTestFlags);
 
-    if (hitTest != wxRICHTEXT_HITTEST_NONE && hitObj)
+    if (hitObj &&
+        ((hitTest & wxRICHTEXT_HITTEST_NONE) == 0) &&
+        (! (hitObj == (& m_buffer) && ((hitTest & wxRICHTEXT_HITTEST_OUTSIDE) != 0))) // outside the buffer counts as 'do nothing'
+        )
     {
         if (notInThisObject)
         {
@@ -3009,12 +3012,12 @@ void wxRichTextCtrl::Redo()
 
 bool wxRichTextCtrl::CanUndo() const
 {
-    return GetCommandProcessor()->CanUndo();
+    return GetCommandProcessor()->CanUndo() && IsEditable();
 }
 
 bool wxRichTextCtrl::CanRedo() const
 {
-    return GetCommandProcessor()->CanRedo();
+    return GetCommandProcessor()->CanRedo() && IsEditable();
 }
 
 // ----------------------------------------------------------------------------