+/* Called after the default handler, and thus after the text was
+ inserted. We use this to insert a break after a ',' or a ';'*/
+static void
+modest_recpt_editor_on_insert_text_after (GtkTextBuffer *buffer,
+ GtkTextIter *location,
+ gchar *text,
+ gint len,
+ ModestRecptEditor *editor)
+{
+ GtkTextIter prev;
+ gunichar prev_char;
+ ModestRecptEditorPrivate *priv = MODEST_RECPT_EDITOR_GET_PRIVATE (editor);
+
+ prev = *location;
+ if (!gtk_text_iter_backward_char (&prev))
+ return;
+
+ prev_char = gtk_text_iter_get_char (&prev);
+ g_signal_handlers_block_by_func (buffer, modest_recpt_editor_on_insert_text, editor);
+ g_signal_handlers_block_by_func (buffer, modest_recpt_editor_on_insert_text_after, editor);
+ if ((prev_char == ';'||prev_char == ',')&&(!quote_opened(location))) {
+ GtkTextMark *insert;
+ gtk_text_buffer_insert (buffer, location, "\n",-1);
+ insert = gtk_text_buffer_get_insert (buffer);
+ gtk_text_view_scroll_to_iter (GTK_TEXT_VIEW (priv->text_view), location, 0.0,TRUE, 0.0, 1.0);
+ }
+ g_signal_handlers_unblock_by_func (buffer, modest_recpt_editor_on_insert_text, editor);
+ g_signal_handlers_unblock_by_func (buffer, modest_recpt_editor_on_insert_text_after, editor);
+}
+
+/* Called before the default handler, we use it to validate the inputs */
+static void