]> git.saurik.com Git - wxWidgets.git/commitdiff
fix for backwards selection in text ctrl (patch 439730)
authorVadim Zeitlin <vadim@wxwidgets.org>
Mon, 9 Jul 2001 22:47:32 +0000 (22:47 +0000)
committerVadim Zeitlin <vadim@wxwidgets.org>
Mon, 9 Jul 2001 22:47:32 +0000 (22:47 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10925 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/univ/textctrl.cpp

index b6a4b8810db6edced8395b39b0a4b47d4054f570..a56e610f6b87fa27aa59934812f853652cca1caf 100644 (file)
@@ -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);
     }
 }