2007-08-06 [colin] 2.10.0cvs95
authorColin Leroy <colin@colino.net>
Mon, 6 Aug 2007 16:39:10 +0000 (16:39 +0000)
committerColin Leroy <colin@colino.net>
Mon, 6 Aug 2007 16:39:10 +0000 (16:39 +0000)
* src/compose.c
* src/compose.h
Re-commit 2.10.0cvs86, with a protection
against Pango bug. Also, try to fix
bug 1275, 'auto-saved draft messages not
always being removed'

ChangeLog
PATCHSETS
configure.ac
src/compose.c
src/compose.h

index c529b742228a79f14cff1fac7558c43555f4c11e..2d32304b680cd30bd3a960ca27ecefbfd28d9474 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2007-08-06 [colin]     2.10.0cvs95
+
+       * src/compose.c
+       * src/compose.h
+               Re-commit 2.10.0cvs86, with a protection
+               against Pango bug. Also, try to fix 
+               bug 1275, 'auto-saved draft messages not 
+               always being removed'
+
 2007-08-06 [wwp]       2.10.0cvs94
 
        * src/gtk/quicksearch.c
index 356fd6e806a197e3bfe58a6c3b7aaccd185c2fdd..4de991c606d14a27c4fb0a80403436874719863f 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.3 -r 1.1.2.4 src/plugins/pgpcore/plugin.def;  ) > 2.10.0cvs92.patchset
 ( cvs diff -u -r 1.105.2.105 -r 1.105.2.106 src/prefs_account.c;  cvs diff -u -r 1.1.2.9 -r 1.1.2.10 src/gtk/combobox.c;  ) > 2.10.0cvs93.patchset
 ( cvs diff -u -r 1.1.2.75 -r 1.1.2.76 src/gtk/quicksearch.c;  ) > 2.10.0cvs94.patchset
+( cvs diff -u -r 1.382.2.399 -r 1.382.2.400 src/compose.c;  cvs diff -u -r 1.50.2.40 -r 1.50.2.41 src/compose.h;  ) > 2.10.0cvs95.patchset
index 0efb27e1f043b344ebd436bcdd8d092edc393938..8a14ba843acf97ed0730e5aa1107581097142139 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=10
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=94
+EXTRA_VERSION=95
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index df545b2094437f01b68bbf9ff8b7ac5b38f878ec..20bb291036068ebf6a2d07089ff0fd25089d7821 100644 (file)
@@ -273,7 +273,7 @@ static gboolean compose_attach_append               (Compose        *compose,
 static void compose_attach_parts               (Compose        *compose,
                                                 MsgInfo        *msginfo);
 
-static void compose_beautify_paragraph         (Compose        *compose,
+static gboolean compose_beautify_paragraph     (Compose        *compose,
                                                 GtkTextIter    *par_iter,
                                                 gboolean        force);
 static void compose_wrap_all                   (Compose        *compose);
@@ -901,26 +901,26 @@ static void compose_create_tags(GtkTextView *text, Compose *compose)
        }
 
        if (prefs_common.enable_color && prefs_common.enable_bgcolor) {
-               gtk_text_buffer_create_tag(buffer, "quote0",
+               compose->quote0_tag = gtk_text_buffer_create_tag(buffer, "quote0",
                                           "foreground-gdk", &quote_color1,
                                           "paragraph-background-gdk", &quote_bgcolor1,
                                           NULL);
-               gtk_text_buffer_create_tag(buffer, "quote1",
+               compose->quote1_tag = gtk_text_buffer_create_tag(buffer, "quote1",
                                           "foreground-gdk", &quote_color2,
                                           "paragraph-background-gdk", &quote_bgcolor2,
                                           NULL);
-               gtk_text_buffer_create_tag(buffer, "quote2",
+               compose->quote2_tag = gtk_text_buffer_create_tag(buffer, "quote2",
                                           "foreground-gdk", &quote_color3,
                                           "paragraph-background-gdk", &quote_bgcolor3,
                                           NULL);
        } else {
-               gtk_text_buffer_create_tag(buffer, "quote0",
+               compose->quote0_tag = gtk_text_buffer_create_tag(buffer, "quote0",
                                           "foreground-gdk", &quote_color1,
                                           NULL);
-               gtk_text_buffer_create_tag(buffer, "quote1",
+               compose->quote1_tag = gtk_text_buffer_create_tag(buffer, "quote1",
                                           "foreground-gdk", &quote_color2,
                                           NULL);
-               gtk_text_buffer_create_tag(buffer, "quote2",
+               compose->quote2_tag = gtk_text_buffer_create_tag(buffer, "quote2",
                                           "foreground-gdk", &quote_color3,
                                           NULL);
        }
@@ -928,7 +928,8 @@ static void compose_create_tags(GtkTextView *text, Compose *compose)
        gtk_text_buffer_create_tag(buffer, "signature",
                                   "foreground-gdk", &signature_color,
                                   NULL);
-       gtk_text_buffer_create_tag(buffer, "link",
+       
+       compose->uri_tag = gtk_text_buffer_create_tag(buffer, "link",
                                        "foreground-gdk", &uri_color,
                                         NULL);
        compose->no_wrap_tag = gtk_text_buffer_create_tag(buffer, "no_wrap", NULL);
@@ -1813,6 +1814,36 @@ static void compose_colorize_signature(Compose *compose)
                }
 }
 
+#define BLOCK_WRAP() {                                                 \
+       prev_autowrap = compose->autowrap;                              \
+       buffer = gtk_text_view_get_buffer(                              \
+                                       GTK_TEXT_VIEW(compose->text));  \
+       compose->autowrap = FALSE;                                      \
+                                                                       \
+       g_signal_handlers_block_by_func(G_OBJECT(buffer),               \
+                               G_CALLBACK(compose_changed_cb),         \
+                               compose);                               \
+       g_signal_handlers_block_by_func(G_OBJECT(buffer),               \
+                               G_CALLBACK(text_inserted),              \
+                               compose);                               \
+}
+#define UNBLOCK_WRAP() {                                               \
+       compose->autowrap = prev_autowrap;                              \
+       if (compose->autowrap) {                                        \
+               gint old = compose->draft_timeout_tag;                  \
+               compose->draft_timeout_tag = -2;                        \
+               compose_wrap_all(compose);                              \
+               compose->draft_timeout_tag = old;                       \
+       }                                                               \
+                                                                       \
+       g_signal_handlers_unblock_by_func(G_OBJECT(buffer),             \
+                               G_CALLBACK(compose_changed_cb),         \
+                               compose);                               \
+       g_signal_handlers_unblock_by_func(G_OBJECT(buffer),             \
+                               G_CALLBACK(text_inserted),              \
+                               compose);                               \
+}
+
 Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
 {
        Compose *compose = NULL;
@@ -2014,14 +2045,13 @@ Compose *compose_reedit(MsgInfo *msginfo, gboolean batch)
 
        if (fp != NULL) {
                gboolean prev_autowrap = compose->autowrap;
-
-               compose->autowrap = FALSE;
+               GtkTextBuffer *buffer = textbuf;
+               BLOCK_WRAP();
                while (fgets(buf, sizeof(buf), fp) != NULL) {
                        strcrchomp(buf);
                        gtk_text_buffer_insert(textbuf, &iter, buf, -1);
                }
-               compose_wrap_all_full(compose, FALSE);
-               compose->autowrap = prev_autowrap;
+               UNBLOCK_WRAP();
                fclose(fp);
        }
        
@@ -2983,8 +3013,7 @@ static void compose_insert_sig(Compose *compose, gboolean replace)
        
        g_return_if_fail(compose->account != NULL);
 
-       prev_autowrap = compose->autowrap;
-       compose->autowrap = FALSE;
+       BLOCK_WRAP();
 
        g_signal_handlers_block_by_func(G_OBJECT(buffer),
                                        G_CALLBACK(compose_changed_cb),
@@ -3057,9 +3086,7 @@ again:
                                        G_CALLBACK(compose_changed_cb),
                                        compose);
                
-       compose->autowrap = prev_autowrap;
-       if (compose->autowrap)
-               compose_wrap_all(compose);
+       UNBLOCK_WRAP();
 }
 
 static gchar *compose_get_signature_str(Compose *compose)
@@ -3573,8 +3600,16 @@ static gboolean compose_get_line_break_pos(GtkTextBuffer *buffer,
        gtk_text_iter_forward_to_line_end(&line_end);
        str = gtk_text_buffer_get_text(buffer, &iter, &line_end, FALSE);
        len = g_utf8_strlen(str, -1);
+       
+       if (len == 0) {
+               g_free(str);
+               g_warning("compose_get_line_break_pos: len = 0!\n");
+               return FALSE;
+       }
+
        /* g_print("breaking line: %d: %s (len = %d)\n",
                gtk_text_iter_get_line(&iter), str, len); */
+
        attrs = g_new(PangoLogAttr, len + 1);
 
        pango_default_break(str, -1, NULL, attrs, len + 1);
@@ -3764,8 +3799,7 @@ static gboolean compose_join_next_line(Compose *compose,
                g_warning("alloc error scanning URIs\n"); \
        }
 
-static gboolean automatic_break = FALSE;
-static void compose_beautify_paragraph(Compose *compose, GtkTextIter *par_iter, gboolean force)
+static gboolean compose_beautify_paragraph(Compose *compose, GtkTextIter *par_iter, gboolean force)
 {
        GtkTextView *text = GTK_TEXT_VIEW(compose->text);
        GtkTextBuffer *buffer;
@@ -3779,6 +3813,18 @@ static void compose_beautify_paragraph(Compose *compose, GtkTextIter *par_iter,
        gint nouri_start = -1, nouri_stop = -1;
        gint num_blocks = 0;
        gint quotelevel = -1;
+       gboolean modified = force;
+       gboolean removed = FALSE;
+       gboolean modified_before_remove = FALSE;
+       gint lines = 0;
+       gboolean start = TRUE;
+
+       if (force) {
+               modified = TRUE;
+       }
+       if (compose->draft_timeout_tag == -2) {
+               modified = TRUE;
+       }
 
        compose->autowrap = FALSE;
 
@@ -3792,24 +3838,26 @@ static void compose_beautify_paragraph(Compose *compose, GtkTextIter *par_iter,
                gtk_text_buffer_get_iter_at_mark(buffer, &iter, mark);
        }
 
-       /* move to paragraph start */
-       gtk_text_iter_set_line_offset(&iter, 0);
-       if (gtk_text_iter_ends_line(&iter)) {
-               while (gtk_text_iter_ends_line(&iter) &&
-                      gtk_text_iter_forward_line(&iter))
-                       ;
-       } else {
-               while (gtk_text_iter_backward_line(&iter)) {
-                       if (gtk_text_iter_ends_line(&iter)) {
-                               gtk_text_iter_forward_line(&iter);
-                               break;
+
+       if (compose->draft_timeout_tag == -2) {
+               if (gtk_text_iter_ends_line(&iter)) {
+                       while (gtk_text_iter_ends_line(&iter) &&
+                              gtk_text_iter_forward_line(&iter))
+                               ;
+               } else {
+                       while (gtk_text_iter_backward_line(&iter)) {
+                               if (gtk_text_iter_ends_line(&iter)) {
+                                       gtk_text_iter_forward_line(&iter);
+                                       break;
+                               }
                        }
                }
+       } else {
+               /* move to line start */
+               gtk_text_iter_set_line_offset(&iter, 0);
        }
-
        /* go until paragraph end (empty line) */
-       
-       while (!gtk_text_iter_ends_line(&iter)) {
+       while (start || !gtk_text_iter_ends_line(&iter)) {
                gchar *scanpos = NULL;
                /* parse table - in order of priority */
                struct table {
@@ -3844,6 +3892,7 @@ static void compose_beautify_paragraph(Compose *compose, GtkTextIter *par_iter,
                gchar *o_walk = NULL, *walk = NULL, *bp = NULL, *ep = NULL;
                gint walk_pos;
                
+               start = FALSE;
                if (!prev_autowrap && num_blocks == 0) {
                        num_blocks++;
                        g_signal_handlers_block_by_func(G_OBJECT(buffer),
@@ -3881,19 +3930,23 @@ static void compose_beautify_paragraph(Compose *compose, GtkTextIter *par_iter,
                if (prev_autowrap == FALSE && !force && !wrap_quote) {
                        goto colorize;
                }
-               if (compose_get_line_break_pos(buffer, &iter, &break_pos,
+               if (gtk_text_iter_ends_line(&iter)) {
+                       goto colorize;
+               } else if (compose_get_line_break_pos(buffer, &iter, &break_pos,
                                               prefs_common.linewrap_len,
                                               quote_len)) {
                        GtkTextIter prev, next, cur;
-                       
+
                        if (prev_autowrap != FALSE || force) {
-                               automatic_break = TRUE;
+                               compose->automatic_break = TRUE;
+                               modified = TRUE;
                                gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
-                               automatic_break = FALSE;
+                               compose->automatic_break = FALSE;
                        } else if (quote_str && wrap_quote) {
-                               automatic_break = TRUE;
+                               compose->automatic_break = TRUE;
+                               modified = TRUE;
                                gtk_text_buffer_insert(buffer, &break_pos, "\n", 1);
-                               automatic_break = FALSE;
+                               compose->automatic_break = FALSE;
                        } else 
                                goto colorize;
                        /* remove trailing spaces */
@@ -3920,7 +3973,7 @@ static void compose_beautify_paragraph(Compose *compose, GtkTextIter *par_iter,
                                                       quote_str, -1);
 
                        iter = break_pos;
-                       compose_join_next_line(compose, buffer, &iter, quote_str);
+                       modified |= compose_join_next_line(compose, buffer, &iter, quote_str);
 
                        /* move iter to current line start */
                        gtk_text_iter_set_line_offset(&iter, 0);
@@ -3928,10 +3981,11 @@ static void compose_beautify_paragraph(Compose *compose, GtkTextIter *par_iter,
                                g_free(quote_str);
                                quote_str = NULL;
                        }
-                       continue;
+                       continue;       
                } else {
                        /* move iter to next line start */
                        iter = break_pos;
+                       lines++;
                }
 
 colorize:
@@ -3991,14 +4045,41 @@ colorize:
                        endquote = iter;
 
                        switch (quotelevel) {
-                       case 0: gtk_text_buffer_apply_tag_by_name(
-                                       buffer, "quote0", &startquote, &endquote);
+                       case 0: 
+                               if (!gtk_text_iter_has_tag(&startquote, compose->quote0_tag) ||
+                                   !gtk_text_iter_has_tag(&end_of_line, compose->quote0_tag)) {
+                                       gtk_text_buffer_apply_tag_by_name(
+                                               buffer, "quote0", &startquote, &endquote);
+                                       gtk_text_buffer_remove_tag_by_name(
+                                               buffer, "quote1", &startquote, &endquote);
+                                       gtk_text_buffer_remove_tag_by_name(
+                                               buffer, "quote2", &startquote, &endquote);
+                                       modified = TRUE;
+                               }
                                break;
-                       case 1: gtk_text_buffer_apply_tag_by_name(
-                                       buffer, "quote1", &startquote, &endquote);
+                       case 1: 
+                               if (!gtk_text_iter_has_tag(&startquote, compose->quote1_tag) ||
+                                   !gtk_text_iter_has_tag(&end_of_line, compose->quote1_tag)) {
+                                       gtk_text_buffer_apply_tag_by_name(
+                                               buffer, "quote1", &startquote, &endquote);
+                                       gtk_text_buffer_remove_tag_by_name(
+                                               buffer, "quote0", &startquote, &endquote);
+                                       gtk_text_buffer_remove_tag_by_name(
+                                               buffer, "quote2", &startquote, &endquote);
+                                       modified = TRUE;
+                               }
                                break;
-                       case 2: gtk_text_buffer_apply_tag_by_name(
-                                       buffer, "quote2", &startquote, &endquote);
+                       case 2: 
+                               if (!gtk_text_iter_has_tag(&startquote, compose->quote2_tag) ||
+                                   !gtk_text_iter_has_tag(&end_of_line, compose->quote2_tag)) {
+                                       gtk_text_buffer_apply_tag_by_name(
+                                               buffer, "quote2", &startquote, &endquote);
+                                       gtk_text_buffer_remove_tag_by_name(
+                                               buffer, "quote0", &startquote, &endquote);
+                                       gtk_text_buffer_remove_tag_by_name(
+                                               buffer, "quote1", &startquote, &endquote);
+                                       modified = TRUE;
+                               }
                                break;
                        }
                        startq_offset = -1;
@@ -4007,39 +4088,71 @@ colorize:
                        gtk_text_buffer_get_iter_at_offset(
                                buffer, &startnoquote, noq_offset);
                        endnoquote = iter;
-                       gtk_text_buffer_remove_tag_by_name(
-                               buffer, "quote0", &startnoquote, &endnoquote);
-                       gtk_text_buffer_remove_tag_by_name(
-                               buffer, "quote1", &startnoquote, &endnoquote);
-                       gtk_text_buffer_remove_tag_by_name(
-                               buffer, "quote2", &startnoquote, &endnoquote);
+
+                       if ((gtk_text_iter_has_tag(&startnoquote, compose->quote0_tag)
+                         && gtk_text_iter_has_tag(&end_of_line, compose->quote0_tag)) ||
+                           (gtk_text_iter_has_tag(&startnoquote, compose->quote1_tag)
+                         && gtk_text_iter_has_tag(&end_of_line, compose->quote1_tag)) ||
+                           (gtk_text_iter_has_tag(&startnoquote, compose->quote2_tag)
+                         && gtk_text_iter_has_tag(&end_of_line, compose->quote2_tag))) {
+                               gtk_text_buffer_remove_tag_by_name(
+                                       buffer, "quote0", &startnoquote, &endnoquote);
+                               gtk_text_buffer_remove_tag_by_name(
+                                       buffer, "quote1", &startnoquote, &endnoquote);
+                               gtk_text_buffer_remove_tag_by_name(
+                                       buffer, "quote2", &startnoquote, &endnoquote);
+                               modified = TRUE;
+                       }
                        noq_offset = -1;
                }
                
-               /* always */ {
+               if (uri_start != nouri_start && uri_stop != nouri_stop) {
                        GtkTextIter nouri_start_iter, nouri_end_iter;
                        gtk_text_buffer_get_iter_at_offset(
                                buffer, &nouri_start_iter, nouri_start);
                        gtk_text_buffer_get_iter_at_offset(
                                buffer, &nouri_end_iter, nouri_stop);
-                       gtk_text_buffer_remove_tag_by_name(
-                               buffer, "link", &nouri_start_iter, &nouri_end_iter);
+                       if (gtk_text_iter_has_tag(&nouri_start_iter, compose->uri_tag) &&
+                           gtk_text_iter_has_tag(&nouri_end_iter, compose->uri_tag)) {
+                               gtk_text_buffer_remove_tag_by_name(
+                                       buffer, "link", &nouri_start_iter, &nouri_end_iter);
+                               modified_before_remove = modified;
+                               modified = TRUE;
+                               removed = TRUE;
+                       }
                }
                if (uri_start > 0 && uri_stop > 0) {
-                       GtkTextIter uri_start_iter, uri_end_iter;
+                       GtkTextIter uri_start_iter, uri_end_iter, back;
                        gtk_text_buffer_get_iter_at_offset(
                                buffer, &uri_start_iter, uri_start);
                        gtk_text_buffer_get_iter_at_offset(
                                buffer, &uri_end_iter, uri_stop);
-                       gtk_text_buffer_apply_tag_by_name(
-                               buffer, "link", &uri_start_iter, &uri_end_iter);
+                       back = uri_end_iter;
+                       gtk_text_iter_backward_char(&back);
+                       if (!gtk_text_iter_has_tag(&uri_start_iter, compose->uri_tag) ||
+                           !gtk_text_iter_has_tag(&back, compose->uri_tag)) {
+                               gtk_text_buffer_apply_tag_by_name(
+                                       buffer, "link", &uri_start_iter, &uri_end_iter);
+                               modified = TRUE;
+                               if (removed && !modified_before_remove) {
+                                       modified = FALSE;
+                               } 
+                       }
+               }
+               if (!modified) {
+                       debug_print("not modified, out after %d lines\n", lines);
+                       goto end;
                }
        }
 
+       debug_print("modified, out after %d lines\n", lines);
+end:
        if (par_iter)
                *par_iter = iter;
        undo_wrapping(compose->undostruct, FALSE);
        compose->autowrap = prev_autowrap;
+       
+       return modified;
 }
 
 void compose_action_cb(void *data)
@@ -4058,12 +4171,13 @@ static void compose_wrap_all_full(Compose *compose, gboolean force)
        GtkTextView *text = GTK_TEXT_VIEW(compose->text);
        GtkTextBuffer *buffer;
        GtkTextIter iter;
+       gboolean modified = TRUE;
 
        buffer = gtk_text_view_get_buffer(text);
 
        gtk_text_buffer_get_start_iter(buffer, &iter);
-       while (!gtk_text_iter_is_end(&iter))
-               compose_beautify_paragraph(compose, &iter, force);
+       while (!gtk_text_iter_is_end(&iter) && modified)
+               modified = compose_beautify_paragraph(compose, &iter, force);
 
 }
 
@@ -5033,6 +5147,8 @@ static gint compose_remove_reedit_target(Compose *compose, gboolean force)
                if (folder_item_remove_msg(item, msginfo->msgnum) < 0) {
                        g_warning("can't remove the old message\n");
                        return -1;
+               } else {
+                       debug_print("removed reedit target %d\n", msginfo->msgnum);
                }
        }
 
@@ -6160,32 +6276,6 @@ static void compose_savemsg_select_cb(GtkWidget *widget, Compose *compose)
 static void entry_paste_clipboard(Compose *compose, GtkWidget *entry, gboolean wrap,
                                  GdkAtom clip, GtkTextIter *insert_place);
 
-#define BLOCK_WRAP() {                                                 \
-       prev_autowrap = compose->autowrap;                              \
-       buffer = gtk_text_view_get_buffer(                              \
-                                       GTK_TEXT_VIEW(compose->text));  \
-       compose->autowrap = FALSE;                                      \
-                                                                       \
-       g_signal_handlers_block_by_func(G_OBJECT(buffer),               \
-                               G_CALLBACK(compose_changed_cb),         \
-                               compose);                               \
-       g_signal_handlers_block_by_func(G_OBJECT(buffer),               \
-                               G_CALLBACK(text_inserted),              \
-                               compose);                               \
-}
-#define UNBLOCK_WRAP() {                                               \
-       compose->autowrap = prev_autowrap;                              \
-       if (compose->autowrap)                                          \
-               compose_wrap_all(compose);                              \
-                                                                       \
-       g_signal_handlers_unblock_by_func(G_OBJECT(buffer),             \
-                               G_CALLBACK(compose_changed_cb),         \
-                               compose);                               \
-       g_signal_handlers_unblock_by_func(G_OBJECT(buffer),             \
-                               G_CALLBACK(text_inserted),              \
-                               compose);                               \
-}
-
 
 static gboolean text_clicked(GtkWidget *text, GdkEventButton *event,
                                        Compose *compose)
@@ -8387,6 +8477,22 @@ gboolean compose_draft (gpointer data, guint action)
 
        folder_item_scan(draft);
        if ((msgnum = folder_item_add_msg(draft, tmp, &flag, TRUE)) < 0) {
+               MsgInfo *tmpinfo = NULL;
+               debug_print("didn't get msgnum after adding draft [%s]\n", compose->msgid?compose->msgid:"no msgid");
+               if (compose->msgid) {
+                       tmpinfo = folder_item_get_msginfo_by_msgid(draft, compose->msgid);
+               }
+               if (tmpinfo) {
+                       msgnum = tmpinfo->msgnum;
+                       procmsg_msginfo_free(tmpinfo);
+                       debug_print("got draft msgnum %d from scanning\n", msgnum);
+               } else {
+                       debug_print("didn't get draft msgnum after scanning\n");
+               }
+       } else {
+               debug_print("got draft msgnum %d from adding\n", msgnum);
+       }
+       if (msgnum < 0) {
                g_unlink(tmp);
                g_free(tmp);
                if (action != COMPOSE_AUTO_SAVE) {
@@ -8421,11 +8527,7 @@ gboolean compose_draft (gpointer data, guint action)
        }
 
        newmsginfo = folder_item_get_msginfo(draft, msgnum);
-       if (!newmsginfo && compose->msgid) {
-               newmsginfo = folder_item_get_msginfo_by_msgid(draft, compose->msgid);
-               if (newmsginfo)
-                       msgnum = newmsginfo->msgnum;
-       }
+
        if (newmsginfo) {
                procmsg_msginfo_unset_flags(newmsginfo, ~0, ~0);
                if (target_locked)
@@ -9631,7 +9733,7 @@ static void text_inserted(GtkTextBuffer *buffer, GtkTextIter *iter,
                gtk_text_buffer_get_iter_at_mark(buffer, iter, mark);
                gtk_text_buffer_place_cursor(buffer, iter);
        } else {
-               if (strcmp(text, "\n") || automatic_break
+               if (strcmp(text, "\n") || compose->automatic_break
                || gtk_text_iter_starts_line(iter))
                        gtk_text_buffer_insert(buffer, iter, text, len);
                else {
index 4e21596be33ab3836dc944a71a32a2fcec1f1929..13967ae9215227bdbec37023c1dd61890cbe7ed0 100644 (file)
@@ -215,6 +215,12 @@ struct _Compose
        
        GtkTextTag *no_wrap_tag;
        GtkTextTag *no_join_tag;
+       GtkTextTag *quote0_tag;
+       GtkTextTag *quote1_tag;
+       GtkTextTag *quote2_tag;
+       GtkTextTag *uri_tag;
+
+       gboolean automatic_break;
        GMutex *mutex;
        gchar *orig_charset;
        gint set_cursor_pos;