shithub: plan9front

Download patch

ref: 2929a3bf67225b16284fd21bb0298bddeac142d1
parent: a5c4ac4804c377759d468adfad94733d46822f36
author: Alex Musolino <alex@musolino.id.au>
date: Wed Jun 30 08:23:45 EDT 2021

upas/Mail: avoid showing empty To: and CC: lines in compose windows

--- a/sys/src/cmd/upas/Mail/comp.c	Wed Jun 30 08:22:28 2021
+++ b/sys/src/cmd/upas/Mail/comp.c	Wed Jun 30 08:23:45 2021
@@ -200,13 +200,17 @@
 	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);