]> Pileus Git - ~andy/gtk/blobdiff - gtk/gtkimcontextsimple.c
Handle chopping off \r\n and 0x2029 in addition to \n before passing to
[~andy/gtk] / gtk / gtkimcontextsimple.c
index 4b346dc9c34ca19b39b628eb51e06a7eda8b5664..36da2c96a934a4a6e6f48c61ec7f576dc96c917c 100644 (file)
@@ -945,6 +945,7 @@ check_hex (GtkIMContextSimple *context_simple,
   GString *str;
   gulong n;
   gchar *nptr = NULL;
+  gchar buf[7];
   
   str = g_string_new (NULL);
   
@@ -952,7 +953,6 @@ check_hex (GtkIMContextSimple *context_simple,
   while (i < n_compose)
     {
       gunichar ch;
-      gchar buf[7];
       
       ch = gdk_keyval_to_unicode (context_simple->compose_buffer[i]);
       
@@ -1223,9 +1223,13 @@ gtk_im_context_simple_get_preedit_string (GtkIMContext   *context,
           len = g_unichar_to_utf8 (context_simple->tentative_match, outbuf);
         }
       
-      g_assert (len <= 25);
+      g_assert (len < 25);
       outbuf[len] = '\0';      
     }
+  else
+    {
+      outbuf[0] = '\0';
+    }
   
   if (str)
     *str = g_strdup (outbuf);