supporting -1 as 'to' parameter for selections
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@50105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1418,7 +1418,10 @@ void wxMacUnicodeTextControl::SetSelection( long from , long to )
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
from = wxMin(textLength,wxMax(from,0)) ;
|
from = wxMin(textLength,wxMax(from,0)) ;
|
||||||
to = wxMax(0,wxMin(textLength,to)) ;
|
if ( to == -1 )
|
||||||
|
to = textLength;
|
||||||
|
else
|
||||||
|
to = wxMax(0,wxMin(textLength,to)) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
sel.selStart = from ;
|
sel.selStart = from ;
|
||||||
@@ -1931,7 +1934,7 @@ void wxMacMLTEControl::Replace( long from , long to , const wxString &str )
|
|||||||
wxMacWindowClipper c( m_peer ) ;
|
wxMacWindowClipper c( m_peer ) ;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
TXNSetSelection( m_txn, from, to ) ;
|
TXNSetSelection( m_txn, from, to == -1 ? kTXNEndOffset : to ) ;
|
||||||
TXNClear( m_txn ) ;
|
TXNClear( m_txn ) ;
|
||||||
SetTXNData( value, kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ;
|
SetTXNData( value, kTXNUseCurrentSelection, kTXNUseCurrentSelection ) ;
|
||||||
}
|
}
|
||||||
@@ -1964,7 +1967,7 @@ void wxMacMLTEControl::SetSelection( long from , long to )
|
|||||||
if ((from == -1) && (to == -1))
|
if ((from == -1) && (to == -1))
|
||||||
TXNSelectAll( m_txn );
|
TXNSelectAll( m_txn );
|
||||||
else
|
else
|
||||||
TXNSetSelection( m_txn, from, to );
|
TXNSetSelection( m_txn, from, to == -1 ? kTXNEndOffset : to );
|
||||||
|
|
||||||
TXNShowSelection( m_txn, kTXNShowStart );
|
TXNShowSelection( m_txn, kTXNShowStart );
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user