Page up/down behaviour now takes into account margins and scale
GetTextForRange takes composites into account properly HasCharacterAttributes correction git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_3_0_BRANCH@77980 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1416,7 +1416,10 @@ wxString wxRichTextCompositeObject::GetTextForRange(const wxRichTextRange& range
|
||||
wxRichTextRange childRange = range;
|
||||
if (!child->GetRange().IsOutside(range))
|
||||
{
|
||||
childRange.LimitTo(child->GetRange());
|
||||
if (child->IsTopLevel())
|
||||
childRange = child->GetOwnRange();
|
||||
else
|
||||
childRange.LimitTo(child->GetRange());
|
||||
|
||||
wxString childText = child->GetTextForRange(childRange);
|
||||
|
||||
@@ -3111,7 +3114,10 @@ wxString wxRichTextParagraphLayoutBox::GetTextForRange(const wxRichTextRange& ra
|
||||
if (!child->GetRange().IsOutside(range))
|
||||
{
|
||||
wxRichTextRange childRange = range;
|
||||
childRange.LimitTo(child->GetRange());
|
||||
if (child->IsTopLevel())
|
||||
childRange = child->GetOwnRange();
|
||||
else
|
||||
childRange.LimitTo(child->GetRange());
|
||||
|
||||
wxString childText = child->GetTextForRange(childRange);
|
||||
|
||||
@@ -3641,6 +3647,7 @@ bool wxRichTextParagraphLayoutBox::HasCharacterAttributes(const wxRichTextRange&
|
||||
{
|
||||
foundCount ++;
|
||||
wxRichTextAttr textAttr = para->GetCombinedAttributes(child->GetAttributes());
|
||||
textAttr.SetFlags(textAttr.GetFlags() & ~wxTEXT_ATTR_PARAGRAPH);
|
||||
|
||||
if (textAttr.EqPartial(style, false /* strong test - attributes must be valid in both objects */))
|
||||
matchingCount ++;
|
||||
|
@@ -2416,7 +2416,10 @@ bool wxRichTextCtrl::PageDown(int noPages, int flags)
|
||||
if (line)
|
||||
{
|
||||
wxSize clientSize = GetClientSize();
|
||||
int newY = line->GetAbsolutePosition().y + noPages*clientSize.y;
|
||||
int topMargin = GetBuffer().GetTopMargin();
|
||||
int bottomMargin = GetBuffer().GetBottomMargin();
|
||||
int height = int( 0.5 + ((clientSize.y - topMargin - bottomMargin) / GetScale()));
|
||||
int newY = line->GetAbsolutePosition().y + noPages*height;
|
||||
|
||||
wxRichTextLine* newLine = GetFocusObject()->GetLineAtYPosition(newY);
|
||||
if (newLine)
|
||||
@@ -3951,7 +3954,9 @@ wxRichTextLine* wxRichTextCtrl::GetVisibleLineForCaretPosition(long caretPositio
|
||||
if (caretPosition == lineRange.GetStart()-1 &&
|
||||
(para->GetRange().GetStart() != lineRange.GetStart()))
|
||||
{
|
||||
if (!m_caretAtLineStart)
|
||||
// Only test for caret start/end position if we're looking at the current caret position,
|
||||
// otherwise m_caretAtLineStart is meaningless
|
||||
if (!m_caretAtLineStart && (caretPosition == m_caretPosition))
|
||||
line = GetFocusObject()->GetLineAtPosition(caretPosition-1, true);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user