summaryrefslogtreecommitdiffstats
path: root/copy.c
diff options
context:
space:
mode:
authorKevin McCarthy <kevin@8t8.us>2021-01-23 18:14:02 -0800
committerKevin McCarthy <kevin@8t8.us>2021-01-24 13:42:06 -0800
commitc6700b05bc7d879fc23903b0023c7274e7bdfcd4 (patch)
tree9375a7e7e06b3f4d2c97b6cf0f2e99521a2b06fb /copy.c
parent075a4c706ade0988406c31814a49564decbdeb45 (diff)
Fix double spacing after group display-name in pager and message.
Edit-headers and message writing uses mutt_write_rfc822_header() -> mutt_write_address_list(), which renders each address one by one and outputs to a file. rfc822_write_address_single() already appends a space after the group display-name colon delimiter. Rendering to the pager uses a different code path: address_header_decode() -> format_address_header(). The logic is very similar to mutt_write_address_list() except it renders to memory. It also needs to avoid re-appending a space after the group display-name.
Diffstat (limited to 'copy.c')
-rw-r--r--copy.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/copy.c b/copy.c
index a86db843..4dc7399b 100644
--- a/copy.c
+++ b/copy.c
@@ -884,6 +884,7 @@ static int copy_delete_attach (BODY *b, FILE *fpin, FILE *fpout,
static void format_address_header (char **h, ADDRESS *a)
{
+ ADDRESS *prev;
char buf[HUGE_STRING];
char cbuf[STRING];
char c2buf[STRING];
@@ -910,7 +911,12 @@ static void format_address_header (char **h, ADDRESS *a)
}
else
{
- if (a->mailbox)
+ /* NOTE: this logic is slightly different from
+ * mutt_write_address_list() because the h function parameter
+ * starts off without a trailing space. e.g. "To:". So this
+ * function prepends a space with the *first* address.
+ */
+ if (a->mailbox && (!count || !prev->group))
{
strcpy (cbuf, " "); /* __STRCPY_CHECKED__ */
linelen++;
@@ -924,6 +930,8 @@ static void format_address_header (char **h, ADDRESS *a)
strcpy (c2buf, ","); /* __STRCPY_CHECKED__ */
}
+ prev = a;
+
cbuflen = mutt_strlen (cbuf);
c2buflen = mutt_strlen (c2buf);
buflen += l + cbuflen + c2buflen;