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

This commit is contained in:
Sigrid 2020-12-04 09:33:55 +01:00
parent 4b6072e60f
commit 4ca5e1b3a3
2 changed files with 13 additions and 3 deletions

View file

@ -4,7 +4,7 @@ faces, seemail, vwhois \- mailbox interface
.SH SYNOPSIS .SH SYNOPSIS
.B faces .B faces
[ [
.B -ih .B -ihc
] [ ] [
.B -m .B -m
.I maildir .I maildir
@ -86,6 +86,12 @@ Multiple
.B -m .B -m
flags may be used to watch multiple mailboxes. flags may be used to watch multiple mailboxes.
.PP .PP
Starting
.I faces
with the
.B -c
flag allows the user to remove faces with a click with button 1.
.PP
The The
.B -h .B -h
flag causes a different, venerable behavior in which flag causes a different, venerable behavior in which

View file

@ -9,6 +9,7 @@
int history = 0; /* use old interface, showing history of mailbox rather than current state */ 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 initload = 0; /* initialize program with contents of mail box */
int clickrm = 0; /* allows removing mail faces by left clicking */
enum enum
{ {
@ -600,7 +601,7 @@ click(int button, Mouse *m)
}else{ }else{
for(i=first; i<last; i++) /* clear vwhois faces */ for(i=first; i<last; i++) /* clear vwhois faces */
if(ptinrect(p, facerect(i-first)) if(ptinrect(p, facerect(i-first))
&& strstr(faces[i]->str[Sshow], "/XXXvwhois")){ && (clickrm || strstr(faces[i]->str[Sshow], "/XXXvwhois"))){
delface(i); delface(i);
flushimage(display, 1); flushimage(display, 1);
} }
@ -675,7 +676,7 @@ startproc(void (*f)(void), int index)
void void
usage(void) usage(void)
{ {
fprint(2, "usage: faces [-hi] [-m maildir]\n"); fprint(2, "usage: faces [-chi] [-m maildir]\n");
exits("usage"); exits("usage");
} }
@ -695,6 +696,9 @@ main(int argc, char *argv[])
addmaildir(EARGF(usage())); addmaildir(EARGF(usage()));
maildir = nil; maildir = nil;
break; break;
case 'c':
clickrm++;
break;
default: default:
usage(); usage();
}ARGEND }ARGEND