]> mj.ucw.cz Git - checkmail.git/commitdiff
Added "simple TAB" mode in which TAB ignores priorities
authorMartin Mares <mj@ucw.cz>
Tue, 22 Jul 2014 15:28:59 +0000 (17:28 +0200)
committerMartin Mares <mj@ucw.cz>
Tue, 22 Jul 2014 15:28:59 +0000 (17:28 +0200)
cm.c

diff --git a/cm.c b/cm.c
index 641b5530841bc787651554d73d67ce8f6b275e10..fb0fb7004e1cfbb817f30c954a9fc3a98787d073 100644 (file)
--- a/cm.c
+++ b/cm.c
@@ -38,6 +38,7 @@ static int allow_osd = 1;
 static int minimum_priority;
 static time_t last_scan_time;
 static char *run_cmd = "mutt -f %s";
+static int simple_tab;
 
 struct options {
   int priority;
@@ -1246,10 +1247,21 @@ next_active(int since, int step)
   do
     {
       struct mbox *b = mbox_array[i];
-      if (b->new && b->o.priority > bestp)
+      if (simple_tab)
        {
-         besti = i;
-         bestp = b->o.priority;
+         if (b->new)
+           {
+             besti = i;
+             break;
+           }
+       }
+      else
+       {
+         if (b->new && b->o.priority > bestp)
+           {
+             besti = i;
+             bestp = b->o.priority;
+           }
        }
       i = (i+step) % cursor_max;
     }
@@ -1336,6 +1348,7 @@ Options:\n\
 -o <opts>\t\tSet default options for all mailboxes\n\
 -p <pri>\t\tSet minimum priority to show\n\
 -s <key>=<val>\t\tSet on-screen display options (consult OSDD docs)\n\
+-t\t\t\tLet TAB select the next mailbox with new mail, no matter what priority it has\n\
 \n\
 Mailbox options (set with `-o', use upper case to negate):\n\
 0-9\t\t\tSet mailbox priority (0=default)\n\
@@ -1435,7 +1448,7 @@ main(int argc, char **argv)
   clist_init(&osd_opts);
 
   int c;
-  while ((c = getopt(argc, argv, "c:dim:o:p:s:")) >= 0)
+  while ((c = getopt(argc, argv, "c:dim:o:p:s:t")) >= 0)
     switch (c)
       {
       case 'c':
@@ -1461,6 +1474,9 @@ main(int argc, char **argv)
       case 's':
        add_osd_opt(optarg);
        break;
+      case 't':
+       simple_tab = 1;
+       break;
       default:
        usage();
       }