Fix XYToPosition() for the last position in first line in wxGTK

This is similar to e74fb5effe for wxMSW
and ensures that we don't consider the last position on the first line
invalid in wxGTK neither.

This fixes TextCtrlTestCase::XYToPositionSingleLine() unit test failure.
This commit is contained in:
Vadim Zeitlin
2017-11-07 03:42:23 +01:00
parent 72fe57ec18
commit 1c4e8377b7

View File

@@ -1192,8 +1192,7 @@ long wxTextCtrl::XYToPosition(long x, long y ) const
{
if ( IsSingleLine() )
{
if ( y != 0 || x >= GTKGetEntryTextLength(GTK_ENTRY(m_text)) )
if ( y != 0 || x > GTKGetEntryTextLength(GTK_ENTRY(m_text)) )
return -1;
return x;