#endif
#include <signal.h>
#include <errno.h>
+#ifndef G_OS_WIN32 /* fixme we should have a configure test. */
#include <libgen.h>
+#endif
#if (HAVE_WCTYPE_H && HAVE_WCHAR_H)
# include <wchar.h>
"foreground-gdk", &uri_color,
NULL);
compose->no_wrap_tag = gtk_text_buffer_create_tag(buffer, "no_wrap", NULL);
+ compose->no_join_tag = gtk_text_buffer_create_tag(buffer, "no_join", NULL);
}
Compose *compose_new(PrefsAccount *account, const gchar *mailto,
}
}
+#define SIGNAL_BLOCK(buffer) { \
+ 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 SIGNAL_UNBLOCK(buffer) { \
+ 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 Compose *compose_generic_reply(MsgInfo *msginfo, gboolean quote,
gboolean to_all, gboolean to_ml,
gboolean to_sender,
compose_force_encryption(compose, account, FALSE);
}
+ SIGNAL_BLOCK(textbuf);
+
if (account->auto_sig)
compose_insert_sig(compose, FALSE);
compose_wrap_all(compose);
+ SIGNAL_UNBLOCK(textbuf);
+
gtk_widget_grab_focus(compose->text);
undo_unblock(compose->undostruct);
procmsg_msginfo_free(full_msginfo);
}
+ SIGNAL_BLOCK(textbuf);
+
if (account->auto_sig)
compose_insert_sig(compose, FALSE);
compose_wrap_all(compose);
+ SIGNAL_UNBLOCK(textbuf);
+
gtk_text_buffer_get_start_iter(textbuf, &iter);
gtk_text_buffer_place_cursor(textbuf, &iter);
_("Fw: multiple emails"));
}
+ SIGNAL_BLOCK(textbuf);
+
if (account->auto_sig)
compose_insert_sig(compose, FALSE);
compose_wrap_all(compose);
+ SIGNAL_UNBLOCK(textbuf);
+
gtk_text_buffer_get_start_iter(textbuf, &iter);
gtk_text_buffer_place_cursor(textbuf, &iter);
GtkTextMark *mark;
- 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);
+ SIGNAL_BLOCK(buffer);
if (!msginfo)
msginfo = &dummyinfo;
error:
buf = NULL;
ok:
- 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);
+ SIGNAL_UNBLOCK(buffer);
return buf;
if (quote_len > 0)
gtk_text_buffer_delete(buffer, &iter_, &end);
- /* delete linebreak and extra spaces */
+ /* don't join line breaks put by the user */
prev = cur = iter_;
+ gtk_text_iter_backward_char(&cur);
+ if (gtk_text_iter_has_tag(&cur, compose->no_join_tag)) {
+ return FALSE;
+ }
+ gtk_text_iter_forward_char(&cur);
+ /* delete linebreak and extra spaces */
while (gtk_text_iter_backward_char(&cur)) {
wc1 = gtk_text_iter_get_char(&cur);
if (!g_unichar_isspace(wc1))
/* move iter to current line start */
gtk_text_iter_set_line_offset(&iter, 0);
+ if (quote_str) {
+ g_free(quote_str);
+ quote_str = NULL;
+ }
continue;
} else {
/* move iter to next line start */
"the main window to retry."));
if (prefs_common.send_dialog_mode == SEND_DIALOG_ALWAYS) {
compose->sending = FALSE;
+ compose->modified = TRUE;
compose_allow_user_actions (compose, TRUE);
}
return 0;
"the main window to retry."));
if (prefs_common.send_dialog_mode == SEND_DIALOG_ALWAYS) {
compose_allow_user_actions (compose, TRUE);
+ compose->modified = TRUE;
compose->sending = FALSE;
}
return -1;
bail:
compose_allow_user_actions (compose, TRUE);
compose->sending = FALSE;
+ compose->modified = TRUE;
return -1;
}
mimemsg->type = MIMETYPE_MESSAGE;
mimemsg->subtype = g_strdup("rfc822");
mimemsg->content = MIMECONTENT_MEM;
+ mimemsg->tmp = TRUE; /* must free content later */
mimemsg->data.mem = compose_get_header(compose);
/* Create text part MimeInfo */
mimetext = procmime_mimeinfo_new();
mimetext->content = MIMECONTENT_MEM;
+ mimetext->tmp = TRUE; /* must free content later */
mimetext->data.mem = buf;
mimetext->type = MIMETYPE_TEXT;
mimetext->subtype = g_strdup("plain");
mimepart = procmime_mimeinfo_new();
mimepart->content = MIMECONTENT_FILE;
mimepart->data.filename = g_strdup(ainfo->file);
+ mimepart->tmp = FALSE; /* or we destroy our attachment */
mimepart->offset = 0;
stat(ainfo->file, &statbuf);
gtk_text_buffer_get_iter_at_mark(buffer, iter, mark);
gtk_text_buffer_place_cursor(buffer, iter);
- } else
- gtk_text_buffer_insert(buffer, iter, text, len);
-
+ } else {
+ if (strcmp(text, "\n"))
+ gtk_text_buffer_insert(buffer, iter, text, len);
+ else
+ gtk_text_buffer_insert_with_tags_by_name(buffer,
+ iter, text, len, "no_join", NULL);
+ }
+
mark = gtk_text_buffer_create_mark(buffer, NULL, iter, FALSE);
compose_beautify_paragraph(compose, iter, FALSE);