git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35147
c3d73ce0-8a6f-49c7-b76d-
6d57e0e08775
+The position value, or -1 if {\tt x} or {\tt y} was invalid.
\membersection{wxTextCtrl::operator \cinsert}\label{wxtextctrlinsert}
\membersection{wxTextCtrl::operator \cinsert}\label{wxtextctrlinsert}
#ifdef __WXGTK20__
GtkTextIter iter;
#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'
#else
long pos=0;
for( int i=0; i<y; i++ ) pos += GetLineLength(i) + 1; // one for '\n'
#ifdef __WXGTK20__
GtkTextIter iter;
#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'
#else
long pos=0;
for( int i=0; i<y; i++ ) pos += GetLineLength(i) + 1; // one for '\n'