Fixes for incorrect selection, extra newline insertion when undoing deletion of selection,
insufficient refresh for operations on last line, HasCharacter/ParagraphAttributes bug. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@63358 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -2986,7 +2986,7 @@ bool wxRichTextParagraphLayoutBox::HasCharacterAttributes(const wxRichTextRange&
|
|||||||
{
|
{
|
||||||
// Stop searching if we're beyond the range of interest
|
// Stop searching if we're beyond the range of interest
|
||||||
if (para->GetRange().GetStart() > range.GetEnd())
|
if (para->GetRange().GetStart() > range.GetEnd())
|
||||||
return foundCount == matchingCount;
|
return foundCount == matchingCount && foundCount != 0;
|
||||||
|
|
||||||
if (!para->GetRange().IsOutside(range))
|
if (!para->GetRange().IsOutside(range))
|
||||||
{
|
{
|
||||||
@@ -2995,7 +2995,12 @@ bool wxRichTextParagraphLayoutBox::HasCharacterAttributes(const wxRichTextRange&
|
|||||||
while (node2)
|
while (node2)
|
||||||
{
|
{
|
||||||
wxRichTextObject* child = node2->GetData();
|
wxRichTextObject* child = node2->GetData();
|
||||||
if (!child->GetRange().IsOutside(range) && child->IsKindOf(CLASSINFO(wxRichTextPlainText)))
|
// Allow for empty string if no buffer
|
||||||
|
wxRichTextRange childRange = child->GetRange();
|
||||||
|
if (childRange.GetLength() == 0 && GetRange().GetLength() == 1)
|
||||||
|
childRange.SetEnd(childRange.GetEnd()+1);
|
||||||
|
|
||||||
|
if (!childRange.IsOutside(range) && child->IsKindOf(CLASSINFO(wxRichTextPlainText)))
|
||||||
{
|
{
|
||||||
foundCount ++;
|
foundCount ++;
|
||||||
wxTextAttrEx textAttr = para->GetCombinedAttributes(child->GetAttributes());
|
wxTextAttrEx textAttr = para->GetCombinedAttributes(child->GetAttributes());
|
||||||
@@ -3040,7 +3045,7 @@ bool wxRichTextParagraphLayoutBox::HasParagraphAttributes(const wxRichTextRange&
|
|||||||
{
|
{
|
||||||
// Stop searching if we're beyond the range of interest
|
// Stop searching if we're beyond the range of interest
|
||||||
if (para->GetRange().GetStart() > range.GetEnd())
|
if (para->GetRange().GetStart() > range.GetEnd())
|
||||||
return foundCount == matchingCount;
|
return foundCount == matchingCount && foundCount != 0;
|
||||||
|
|
||||||
if (!para->GetRange().IsOutside(range))
|
if (!para->GetRange().IsOutside(range))
|
||||||
{
|
{
|
||||||
@@ -7515,9 +7520,13 @@ void wxRichTextAction::UpdateAppearance(long caretPosition, bool sendUpdateEvent
|
|||||||
}
|
}
|
||||||
// Detect last line in the buffer
|
// Detect last line in the buffer
|
||||||
else if (!node2->GetNext() && para->GetRange().Contains(m_buffer->GetRange().GetEnd()))
|
else if (!node2->GetNext() && para->GetRange().Contains(m_buffer->GetRange().GetEnd()))
|
||||||
|
{
|
||||||
|
// If deleting text, make sure we refresh below as well as above
|
||||||
|
if (positionOffset >= 0)
|
||||||
{
|
{
|
||||||
foundEnd = true;
|
foundEnd = true;
|
||||||
lastY = pt.y + line->GetSize().y;
|
lastY = pt.y + line->GetSize().y;
|
||||||
|
}
|
||||||
|
|
||||||
node2 = wxRichTextLineList::compatibility_iterator();
|
node2 = wxRichTextLineList::compatibility_iterator();
|
||||||
node = wxRichTextObjectList::compatibility_iterator();
|
node = wxRichTextObjectList::compatibility_iterator();
|
||||||
|
@@ -1085,7 +1085,15 @@ bool wxRichTextCtrl::DeleteSelectedContent(long* newPos)
|
|||||||
if (HasSelection())
|
if (HasSelection())
|
||||||
{
|
{
|
||||||
long pos = m_selectionRange.GetStart();
|
long pos = m_selectionRange.GetStart();
|
||||||
GetBuffer().DeleteRangeWithUndo(m_selectionRange, this);
|
wxRichTextRange range = m_selectionRange;
|
||||||
|
|
||||||
|
// SelectAll causes more to be selected than doing it interactively,
|
||||||
|
// and causes a new paragraph to be inserted. So for multiline buffers,
|
||||||
|
// don't delete the final position.
|
||||||
|
if (range.GetEnd() == GetLastPosition() && GetNumberOfLines() > 0)
|
||||||
|
range.SetEnd(range.GetEnd()-1);
|
||||||
|
|
||||||
|
GetBuffer().DeleteRangeWithUndo(range, this);
|
||||||
m_selectionRange.SetRange(-2, -2);
|
m_selectionRange.SetRange(-2, -2);
|
||||||
|
|
||||||
if (newPos)
|
if (newPos)
|
||||||
@@ -2595,7 +2603,7 @@ void wxRichTextCtrl::DoSetSelection(long from, long to, bool WXUNUSED(scrollCare
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxRichTextRange oldSelection = m_selectionRange;
|
wxRichTextRange oldSelection = m_selectionRange;
|
||||||
m_selectionAnchor = from;
|
m_selectionAnchor = from-1;
|
||||||
m_selectionRange.SetRange(from, to-1);
|
m_selectionRange.SetRange(from, to-1);
|
||||||
|
|
||||||
// Have to subtract 2, one because of endPos+1 rule (SetSelection docs) and another to turn into caret position.
|
// Have to subtract 2, one because of endPos+1 rule (SetSelection docs) and another to turn into caret position.
|
||||||
@@ -2816,7 +2824,7 @@ void wxRichTextCtrl::OnSelectAll(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void wxRichTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
|
void wxRichTextCtrl::OnUpdateSelectAll(wxUpdateUIEvent& event)
|
||||||
{
|
{
|
||||||
event.Enable(GetLastPosition() > 0);
|
event.Enable(GetLastPosition() >= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& event)
|
void wxRichTextCtrl::OnContextMenu(wxContextMenuEvent& event)
|
||||||
|
Reference in New Issue
Block a user