]> granicus.if.org Git - mutt/commitdiff
Also accept numbers as input in mutt_multi_choice(). From Byrial.
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 21 Oct 1998 16:07:41 +0000 (16:07 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 21 Oct 1998 16:07:41 +0000 (16:07 +0000)
curs_lib.c

index 113a6ef999ddc16c21d18998a6d767b222b5227e..6b20d68f83abc9208fdf2b99c7003a37f2f86555 100644 (file)
@@ -382,25 +382,36 @@ void mutt_curs_set (int cursor)
 int mutt_multi_choice (char *prompt, char *letters)
 {
   event_t ch;
-  int choice = 0;
+  int choice;
   char *p;
 
   mvaddstr (LINES - 1, 0, prompt);
   clrtoeol ();
-  while (!choice)
+  FOREVER
   {
     mutt_refresh ();
     ch  = mutt_getch ();
     if (ch.ch == -1)
+    {
       choice = -1;
+      break;
+    }
     else
     {
       p = strchr (letters, ch.ch);
       if (p)
+      {
        choice = p - letters + 1;
-      else
-       BEEP ();
+       break;
+      }
+      else if (ch.ch <= '9' && ch.ch > '0')
+      {
+       choice = ch.ch - '0';
+       if (choice <= strlen (letters))
+         break;
+      }
     }
+    BEEP ();
   }
   CLEARLINE (LINES - 1);
   mutt_refresh ();