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
This commit is contained in:
@@ -1334,14 +1334,14 @@ void wxTextCtrl::SetSelection( long from, long to )
|
|||||||
{
|
{
|
||||||
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
wxCHECK_RET( m_text != NULL, wxT("invalid text ctrl") );
|
||||||
|
|
||||||
|
if ( IsMultiLine() )
|
||||||
|
{
|
||||||
if (from == -1 && to == -1)
|
if (from == -1 && to == -1)
|
||||||
{
|
{
|
||||||
from = 0;
|
from = 0;
|
||||||
to = GetValue().length();
|
to = GetValue().length();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( IsMultiLine() )
|
|
||||||
{
|
|
||||||
GtkTextIter fromi, toi;
|
GtkTextIter fromi, toi;
|
||||||
gtk_text_buffer_get_iter_at_offset( m_buffer, &fromi, from );
|
gtk_text_buffer_get_iter_at_offset( m_buffer, &fromi, from );
|
||||||
gtk_text_buffer_get_iter_at_offset( m_buffer, &toi, to );
|
gtk_text_buffer_get_iter_at_offset( m_buffer, &toi, to );
|
||||||
|
Reference in New Issue
Block a user