From 6eb6062821301cd9f3ec6907af98567c2c0b8bce Mon Sep 17 00:00:00 2001
From: Vadim Zeitlin <vadim@wxwidgets.org>
Date: Wed, 15 Sep 2010 22:10:07 +0000
Subject: [PATCH] Fix wxTextEntry::SelectAll() in presence of hints in wxGTK.

Translation of wx (-1, -1) selection to (0, GetValue().length()) in
wxTextCtrl::SetSelection() was unnecessary as it ended up calling the base
class wxTextEntry::SetSelection() version which didn't need it. Moreover, this
translation was actually harmful when the text control happened to show a hint
string as its official value was empty in this case and so SetSelection(0, 0)
was called which didn't do anything and broke clearing/changing the controls
text when it was showing a hint.

Simply don't translate the indices when using a single line control to fix
this.

See #12475.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@65550 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
---
 src/gtk/textctrl.cpp | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp
index f5a78bdf8d..c8f61f1ed9 100644
--- a/src/gtk/textctrl.cpp
+++ b/src/gtk/textctrl.cpp
@@ -1334,14 +1334,14 @@ void wxTextCtrl::SetSelection( long from, long to )
 {
     wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
 
-    if (from == -1 && to == -1)
-    {
-        from = 0;
-        to = GetValue().length();
-    }
-
     if ( IsMultiLine() )
     {
+        if (from == -1 && to == -1)
+        {
+            from = 0;
+            to = GetValue().length();
+        }
+
         GtkTextIter fromi, toi;
         gtk_text_buffer_get_iter_at_offset( m_buffer, &fromi, from );
         gtk_text_buffer_get_iter_at_offset( m_buffer, &toi, to );
-- 
2.47.2