shithub: riscv

Download patch

ref: 4ca5e1b3a33d49d0904b39477149517665a78d8a
parent: 4b6072e60fd76bd9e61d5eedd56faa57e09bc009
author: Sigrid <[email protected]>
date: Fri Dec 4 04:33:55 EST 2020

faces: add -c option to remove faces with button 1 click (thanks sirjofri)

--- a/sys/man/1/faces
+++ b/sys/man/1/faces
@@ -4,7 +4,7 @@
 .SH SYNOPSIS
 .B faces
 [
-.B -ih
+.B -ihc
 ] [
 .B -m
 .I maildir
@@ -85,6 +85,12 @@
 Multiple
 .B -m
 flags may be used to watch multiple mailboxes.
+.PP
+Starting
+.I faces
+with the
+.B -c
+flag allows the user to remove faces with a click with button 1.
 .PP
 The
 .B -h
--- a/sys/src/cmd/faces/main.c
+++ b/sys/src/cmd/faces/main.c
@@ -9,6 +9,7 @@
 
 int	history = 0;	/* use old interface, showing history of mailbox rather than current state */
 int	initload = 0;	/* initialize program with contents of mail box */
+int	clickrm = 0;	/* allows removing mail faces by left clicking */
 
 enum
 {
@@ -600,7 +601,7 @@
 		}else{
 			for(i=first; i<last; i++)	/* clear vwhois faces */
 				if(ptinrect(p, facerect(i-first)) 
-				&& strstr(faces[i]->str[Sshow], "/XXXvwhois")){
+				&& (clickrm || strstr(faces[i]->str[Sshow], "/XXXvwhois"))){
 					delface(i);
 					flushimage(display, 1);
 				}
@@ -675,7 +676,7 @@
 void
 usage(void)
 {
-	fprint(2, "usage: faces [-hi] [-m maildir]\n");
+	fprint(2, "usage: faces [-chi] [-m maildir]\n");
 	exits("usage");
 }
 
@@ -694,6 +695,9 @@
 	case 'm':
 		addmaildir(EARGF(usage()));
 		maildir = nil;
+		break;
+	case 'c':
+		clickrm++;
 		break;
 	default:
 		usage();