[Commits] [SCM] claws branch, master, updated. 3.15.0-9-g7c16b7e

ticho at claws-mail.org ticho at claws-mail.org
Thu Mar 30 21:20:40 CEST 2017


The branch, master has been updated
       via  7c16b7e353e2e3504b5c2fe675046a6d81425634 (commit)
      from  95ca86061e39f797513e02c2505165d1ef257cef (commit)

Summary of changes:
 src/compose.c |   16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)


- Log -----------------------------------------------------------------
commit 7c16b7e353e2e3504b5c2fe675046a6d81425634
Author: Andrej Kacian <ticho at claws-mail.org>
Date:   Thu Mar 30 21:12:13 2017 +0200

    Make sure outgoing messages have a trailing newline.
    
    This fixes a corner case where if the last line of
    a message is a quote, its last character doesn't get
    displayed when viewing the copy in outbox.

diff --git a/src/compose.c b/src/compose.c
index b7a7f76..4e93862 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -5611,7 +5611,7 @@ error:
 static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gboolean attach_parts)
 {
 	GtkTextBuffer *buffer;
-	GtkTextIter start, end;
+	GtkTextIter start, end, tmp;
 	gchar *chars, *tmp_enc_file, *content;
 	gchar *buf, *msg;
 	const gchar *out_codeset;
@@ -5643,10 +5643,20 @@ static gint compose_write_to_file(Compose *compose, FILE *fp, gint action, gbool
 	mimemsg->data.mem = compose_get_header(compose);
 
 	/* Create text part MimeInfo */
-	/* get all composed text */
 	buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(compose->text));
-	gtk_text_buffer_get_start_iter(buffer, &start);
 	gtk_text_buffer_get_end_iter(buffer, &end);
+	tmp = end;
+
+	/* We make sure that there is a newline at the end. */
+	if (gtk_text_iter_backward_char(&tmp)) {
+		chars = gtk_text_buffer_get_text(buffer, &tmp, &end, FALSE);
+		if (*chars != '\n') {
+			gtk_text_buffer_insert(buffer, &end, "\n", 1);
+		}
+	}
+
+	/* get all composed text */
+	gtk_text_buffer_get_start_iter(buffer, &start);
 	chars = gtk_text_buffer_get_text(buffer, &start, &end, FALSE);
 
 	out_codeset = conv_get_charset_str(compose->out_encoding);

-----------------------------------------------------------------------


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list