as convention, if a text range is (x, -1), it means from x to the end, so if to was -1, set it to the last position

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77768 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-09-23 17:39:16 +00:00
parent 7138937cb1
commit d8618b6814

View File

@@ -941,6 +941,9 @@ void wxTextCtrl::Replace(wxTextPos from, wxTextPos to, const wxString& text)
{
wxTextCoord colStart, colEnd,
lineStart, lineEnd;
// as convention, if `to` equal -1, it means go to the last position
if ( to == -1)
to = GetLastPosition();
if ( (from > to) ||
!PositionToXY(from, &colStart, &lineStart) ||