]> git.saurik.com Git - wxWidgets.git/blobdiff - src/gtk/textctrl.cpp
removed #errors in 2.7 compilation
[wxWidgets.git] / src / gtk / textctrl.cpp
index 9d6379854de690e36d58bfd2ff79072a92180d68..ea62e181859e8f271ae68f646a015a1de94b5927 100644 (file)
@@ -7,10 +7,6 @@
 // Licence:     wxWindows licence
 /////////////////////////////////////////////////////////////////////////////
 
-#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
-#pragma implementation "textctrl.h"
-#endif
-
 // For compilers that support precompilation, includes "wx.h".
 #include "wx/wxprec.h"
 
@@ -168,7 +164,7 @@ extern "C" {
 static void wxGtkTextInsert(GtkWidget *text,
                             GtkTextBuffer *text_buffer,
                             const wxTextAttr& attr,
-                            wxCharBuffer buffer)
+                            const wxCharBuffer& buffer)
 
 {
     gint start_offset;
@@ -1210,8 +1206,14 @@ long wxTextCtrl::XYToPosition(long x, long y ) const
 
 #ifdef __WXGTK20__
     GtkTextIter iter;
-    gtk_text_buffer_get_iter_at_line_offset(m_buffer, &iter, y, x);
-    return gtk_text_iter_get_offset(&iter);
+    if (y >= gtk_text_buffer_get_line_count (m_buffer))
+        return -1;
+
+    gtk_text_buffer_get_iter_at_line(m_buffer, &iter, y);
+    if (x >= gtk_text_iter_get_chars_in_line (&iter))
+        return -1;
+
+    return gtk_text_iter_get_offset(&iter) + x;
 #else
     long pos=0;
     for( int i=0; i<y; i++ ) pos += GetLineLength(i) + 1; // one for '\n'