Fixed selection clearing.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@52827 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Julian Smart
2008-03-26 08:48:15 +00:00
parent 25bc5c55d0
commit c1aec196fc

View File

@@ -1954,7 +1954,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;
} }
@@ -2332,13 +2335,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();
}
} }
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------