X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/71908213057690d5452f72b2b9c8e62b53357170..6443de026310552cacd68a6d0318e73d14929680:/src/univ/textctrl.cpp diff --git a/src/univ/textctrl.cpp b/src/univ/textctrl.cpp index 805c207216..a56e610f6b 100644 --- a/src/univ/textctrl.cpp +++ b/src/univ/textctrl.cpp @@ -118,7 +118,7 @@ // ---------------------------------------------------------------------------- #ifdef __GNUG__ - #pragma implementation "textctrl.h" + #pragma implementation "univtextctrl.h" #endif #include "wx/wxprec.h" @@ -1413,6 +1413,10 @@ void wxTextCtrl::SetSelection(wxTextPos from, wxTextPos to) } else // valid sel range { + // remember the 'to' position as the current position, used to move the + // caret there later + wxTextPos toOrig = to; + OrderPositions(from, to); wxCHECK_RET( to <= GetLastPosition(), @@ -1458,8 +1462,8 @@ void wxTextCtrl::SetSelection(wxTextPos from, wxTextPos to) } //else: nothing to do - // the insertion point is put at the end of selection - DoSetInsertionPoint(to); + // the insertion point is put at the location where the caret was moved + DoSetInsertionPoint(toOrig); } }