[balsa] sendmsg-window: Fix edit headers in GNOME editor
- From: Peter Bloomfield <peterb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [balsa] sendmsg-window: Fix edit headers in GNOME editor
- Date: Sat, 14 May 2022 13:29:43 +0000 (UTC)
commit b84a5a6378e3715066d85dc5081460ce69dfce20
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date: Sat May 14 09:26:38 2022 -0400
sendmsg-window: Fix edit headers in GNOME editor
Stop reading header lines at the blank line that terminates them.
src/sendmsg-window.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/sendmsg-window.c b/src/sendmsg-window.c
index 9b792ce97..c8509aa67 100644
--- a/src/sendmsg-window.c
+++ b/src/sendmsg-window.c
@@ -695,13 +695,14 @@ edit_with_gnome_check(gpointer data) {
return TRUE;
}
if (balsa_app.edit_headers) {
- while (fgets(line, sizeof(line), tmp)) {
+ /* Blank line terminates headers: */
+ while (fgets(line, sizeof(line), tmp) != NULL && line[0] != '\n') {
guint type;
if (line[strlen(line) - 1] == '\n')
line[strlen(line) - 1] = '\0';
- if (libbalsa_str_has_prefix(line, _("Subject:")) == 0) {
+ if (libbalsa_str_has_prefix(line, _("Subject:"))) {
gtk_entry_set_text(GTK_ENTRY(data_real->bsmsg->subject[1]),
line + strlen(_("Subject:")) + 1);
continue;
@@ -730,6 +731,10 @@ edit_with_gnome_check(gpointer data) {
gtk_text_buffer_insert_at_cursor(buffer, line, -1);
sw_buffer_signals_unblock(data_real->bsmsg, buffer);
+ /* We do not know whether the message has been modified, but we mark
+ * it as such, to be on the safe side: */
+ data_real->bsmsg->state = SENDMSG_STATE_MODIFIED;
+
fclose(tmp);
unlink(data_real->filename);
g_free(data_real->filename);
@@ -806,6 +811,7 @@ sw_edit_activated(GSimpleAction * action,
fprintf(tmp, "%s %s\n", _(address_types[type]), addr_string);
g_free(addr_string);
}
+ /* Blank line terminates headers: */
fprintf(tmp, "\n");
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]