X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/4fe83b93a517ca229ff6503eacf81c1177d088e0..7aa18fc78675ced488adc9d42ad306a539334680:/src/richtext/richtextctrl.cpp diff --git a/src/richtext/richtextctrl.cpp b/src/richtext/richtextctrl.cpp index bbd792f9a4..c95805f58a 100644 --- a/src/richtext/richtextctrl.cpp +++ b/src/richtext/richtextctrl.cpp @@ -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) @@ -1799,14 +1800,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 +1836,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) { @@ -2200,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) @@ -3009,12 +3026,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(); } // ----------------------------------------------------------------------------