From: Paul Date: Tue, 9 Dec 2014 10:46:49 +0000 (+0000) Subject: when cancelling a msg written with an external editor, get rid of the draft copy... X-Git-Tag: 3.12.0~200 X-Git-Url: http://git.claws-mail.org/?p=claws.git;a=commitdiff_plain;h=9f4528e13ec256b719d4d9cbd1c5a836f69aee0b;ds=sidebyside when cancelling a msg written with an external editor, get rid of the draft copy. thanks to Darko Koruga. --- diff --git a/src/compose.c b/src/compose.c index 8f51d55b0..8f8997558 100644 --- a/src/compose.c +++ b/src/compose.c @@ -9379,6 +9379,8 @@ static gboolean compose_input_cb(GIOChannel *source, GIOCondition condition, if (buf[0] == '0') { /* success */ GtkTextView *text = GTK_TEXT_VIEW(compose->text); GtkTextBuffer *buffer = gtk_text_view_get_buffer(text); + GtkTextIter start, end; + gchar *chars; gtk_text_buffer_set_text(buffer, "", -1); compose_insert_file(compose, compose->exteditor_file); @@ -9387,6 +9389,14 @@ static gboolean compose_input_cb(GIOChannel *source, GIOCondition condition, if (claws_unlink(compose->exteditor_file) < 0) FILE_OP_ERROR(compose->exteditor_file, "unlink"); + + 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); + chars = gtk_text_buffer_get_text(buffer, &start, &end, FALSE); + if (chars && strlen(chars) > 0) + compose->modified = TRUE; + g_free(chars); } else if (buf[0] == '1') { /* failed */ g_warning("Couldn't exec external editor\n"); if (claws_unlink(compose->exteditor_file) < 0)