From 2929a3bf67225b16284fd21bb0298bddeac142d1 Mon Sep 17 00:00:00 2001 From: Alex Musolino Date: Wed, 30 Jun 2021 12:23:45 +0000 Subject: [PATCH] upas/Mail: avoid showing empty To: and CC: lines in compose windows --- sys/src/cmd/upas/Mail/comp.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/src/cmd/upas/Mail/comp.c b/sys/src/cmd/upas/Mail/comp.c index 125da475a..912a06292 100644 --- a/sys/src/cmd/upas/Mail/comp.c +++ b/sys/src/cmd/upas/Mail/comp.c @@ -200,13 +200,17 @@ show(Biobuf *fd, char *type, char **addrs, int naddrs) if(naddrs == 0) return; qsort(addrs, naddrs, sizeof(char*), strpcmp); + for(i = 1; i < naddrs; i++){ + if(strcmp(addrs[i-1], addrs[i]) == 0) + addrs[i-1] = nil; + } Bprint(fd, "%s: ", type); for(i = 0; i < naddrs; i++){ - if(i > 0 && strcmp(addrs[i-1], addrs[i]) == 0) + if(addrs[i] == nil) continue; w += Bprint(fd, "%s%s", sep, addrs[i]); sep = ", "; - if(w > 50){ + if(w > 50 && i < naddrs-1){ w = 0; sep = ""; Bprint(fd, "\n%s: ", type);