]> granicus.if.org Git - mutt/commitdiff
curs_main.c: Check whether the user pressed a number before putting
authorThomas Roessler <roessler@does-not-exist.org>
Thu, 11 Feb 1999 17:46:03 +0000 (17:46 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Thu, 11 Feb 1999 17:46:03 +0000 (17:46 +0000)
it back onto the stack.  (OP_JUMP)
pattern.c: Vikas' latest fix.

curs_main.c
pattern.c

index d9b580a0177da150c323f12959fa5001eb83494b..4ea66b6c70cbbcc00243d13fae6b1d9a8472ce84 100644 (file)
@@ -606,7 +606,7 @@ int mutt_index_menu (void)
       case OP_JUMP:
 
        CHECK_MSGCOUNT;
-       mutt_ungetch (LastKey, 0);
+        if (isdigit (LastKey)) mutt_ungetch (LastKey, 0);
        buf[0] = 0;
        if (mutt_get_field (_("Jump to message: "), buf, sizeof (buf), 0) != 0
            || !buf[0])
index f9538857292c9180c03e49d10c157eaee63384e8..0103f557acec2ab8ee5d8ccb2b90d59965078216 100644 (file)
--- a/pattern.c
+++ b/pattern.c
@@ -316,6 +316,7 @@ int eat_range (pattern_t *pat, BUFFER *s, BUFFER *err)
   else
     pat->max = M_MAXRANGE;
 
+  SKIPWS (tmp);
   s->dptr = tmp;
   return 0;
 }
@@ -967,6 +968,11 @@ int mutt_pattern_func (int op, char *prompt)
 
     for (i = 0; i < Context->msgcount; i++)
     {
+      /* new limit pattern implicitly uncollapses all threads */
+      Context->hdrs[i]->virtual = -1;
+      Context->hdrs[i]->limited = 0;
+      Context->hdrs[i]->collapsed = 0;
+      Context->hdrs[i]->num_hidden = 0;
       if (mutt_pattern_exec (pat, M_MATCH_FULL_ADDRESS, Context, Context->hdrs[i]))
       {
        Context->hdrs[i]->virtual = Context->vcount;
@@ -976,13 +982,6 @@ int mutt_pattern_func (int op, char *prompt)
        Context->vsize+=THIS_BODY->length + THIS_BODY->offset -
          THIS_BODY->hdr_offset;
       }
-      else
-      {
-       Context->hdrs[i]->virtual = -1;
-       Context->hdrs[i]->limited = 0;
-       Context->hdrs[i]->collapsed = 0;
-       Context->hdrs[i]->num_hidden = 0;
-      }
     }
   }
   else
@@ -994,17 +993,15 @@ int mutt_pattern_func (int op, char *prompt)
        switch (op)
        {
          case M_DELETE:
-         mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE, 1);
-         break;
          case M_UNDELETE:
-         mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE, 0);
-         break;
+           mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_DELETE, 
+                         (op == M_DELETE));
+           break;
          case M_TAG:
-         mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_TAG, 1);
-         break;
          case M_UNTAG:
-         mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_TAG, 0);
-         break;
+           mutt_set_flag (Context, Context->hdrs[Context->v2r[i]], M_TAG, 
+                          (op == M_TAG));
+           break;
        }
       }
     }
@@ -1016,24 +1013,19 @@ int mutt_pattern_func (int op, char *prompt)
 
   if (op == M_LIMIT)
   {
-    Context->collapsed = 0;
     safe_free ((void **) &Context->pattern);
     if (Context->limit_pattern) 
       mutt_pattern_free (&Context->limit_pattern);
     if (!Context->vcount)
     {
+      Context->vcount = Context->msgcount;
       mutt_error _("No messages matched criteria.");
       /* restore full display */
       for (i = 0; i < Context->msgcount; i++)
       {
        Context->hdrs[i]->virtual = i;
-       Context->hdrs[i]->limited = 0;
-       Context->hdrs[i]->num_hidden = 0;
-       Context->hdrs[i]->collapsed = 0;
        Context->v2r[i] = i;
       }
-
-      Context->vcount = Context->msgcount;
     }
     else if (mutt_strncmp (buf, "~A", 2) != 0)
     {