Fixed selection clearing.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_8_BRANCH@52826 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2008-03-26 08:47:58 +00:00
parent a954b0dd20
commit c8de719de2

View File

@@ -1940,7 +1940,10 @@ void wxRichTextCtrl::SelectAll()
void wxRichTextCtrl::SelectNone() void wxRichTextCtrl::SelectNone()
{ {
if (!(GetSelectionRange() == wxRichTextRange(-2, -2))) if (!(GetSelectionRange() == wxRichTextRange(-2, -2)))
SetSelection(-2, -2); {
Refresh(false);
m_selectionRange = wxRichTextRange(-2, -2);
}
m_selectionAnchor = -2; m_selectionAnchor = -2;
} }
@@ -2318,13 +2321,20 @@ void wxRichTextCtrl::SetSelection(long from, long to)
void wxRichTextCtrl::DoSetSelection(long from, long to, bool WXUNUSED(scrollCaret)) void wxRichTextCtrl::DoSetSelection(long from, long to, bool WXUNUSED(scrollCaret))
{ {
m_selectionAnchor = from; if (from == to)
m_selectionRange.SetRange(from, to-1); {
if (from > -2) SelectNone();
m_caretPosition = from-1; }
else
{
m_selectionAnchor = from;
m_selectionRange.SetRange(from, to-1);
if (from > -2)
m_caretPosition = from-1;
Refresh(false); Refresh(false);
PositionCaret(); PositionCaret();
}
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------