GtkWrapMode wrap;
if ( HasFlag( wxTE_DONTWRAP ) )
wrap = GTK_WRAP_NONE;
- else if ( HasFlag( wxTE_LINEWRAP ) )
+ else if ( HasFlag( wxTE_CHARWRAP ) )
wrap = GTK_WRAP_CHAR;
- else // HasFlag(wxTE_WORDWRAP) always true as wxTE_WORDWRAP == 0
+ else if ( HasFlag( wxTE_WORDWRAP ) )
wrap = GTK_WRAP_WORD;
+ else // HasFlag(wxTE_BESTWRAP) always true as wxTE_BESTWRAP == 0
+ {
+ // GTK_WRAP_WORD_CHAR seems to be new in GTK+ 2.4
+#ifdef __WXGTK24__
+ if ( !gtk_check_version(2,4,0) )
+ {
+ wrap = GTK_WRAP_WORD_CHAR;
+ }
+ else
+#endif
+ wrap = GTK_WRAP_WORD;
+ }
gtk_text_view_set_wrap_mode( GTK_TEXT_VIEW( m_text ), wrap );
if (gtk_text_buffer_get_char_count(m_buffer) != 0)
IgnoreNextTextUpdate();
+ if ( !buffer )
+ {
+ // what else can we do? at least don't crash...
+ return;
+ }
+
gtk_text_buffer_set_text( m_buffer, buffer, strlen(buffer) );
#else
#else
wxCharBuffer buffer( wxConvUTF8.cWC2MB( wxConvLocal.cWX2WC( text ) ) );
#endif
+ if ( !buffer )
+ {
+ // what else can we do? at least don't crash...
+ return;
+ }
+
gtk_editable_insert_text( GTK_EDITABLE(m_text), buffer, strlen(buffer), &len );
#else