]> git.saurik.com Git - wxWidgets.git/commitdiff
gtk_text_iter_get_line and get_line_offset work fine on the end iter. Don't bail...
authorMart Raudsepp <leio@gentoo.org>
Fri, 14 Jul 2006 03:46:40 +0000 (03:46 +0000)
committerMart Raudsepp <leio@gentoo.org>
Fri, 14 Jul 2006 03:46:40 +0000 (03:46 +0000)
Fixes one part of bug #1516281, the other part is controversial and probably not reasonable to change.
Also deal with NULL being passed as the x or y pointer, as is done also on wxMSW (this was done on 2.6 branch as
well, but not noted).

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@40089 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/gtk/textctrl.cpp

index f84409ea46987b9e9176f6d9dbee30dd07721ebd..1443e5777904aa768abd5e7c4a15dc004f7bf2a0 100644 (file)
@@ -944,18 +944,20 @@ bool wxTextCtrl::PositionToXY(long pos, long *x, long *y ) const
     {
         GtkTextIter iter;
         gtk_text_buffer_get_iter_at_offset(m_buffer, &iter, pos);
-        if (gtk_text_iter_is_end(&iter))
-            return false;
 
-        *y = gtk_text_iter_get_line(&iter);
-        *x = gtk_text_iter_get_line_offset(&iter);
+        if ( y )
+            *y = gtk_text_iter_get_line(&iter);
+        if ( x )
+            *x = gtk_text_iter_get_line_offset(&iter);
     }
     else // single line control
     {
         if ( pos <= GTK_ENTRY(m_text)->text_length )
         {
-            *y = 0;
-            *x = pos;
+            if ( y )
+                *y = 0;
+            if ( x )
+                *x = pos;
         }
         else
         {