From d8618b68143870ef383dfe24c0c9c82e38d23983 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Tue, 23 Sep 2014 17:39:16 +0000 Subject: [PATCH] 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 --- src/univ/textctrl.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index bbee40053e..7b3838fe21 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -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) ||