]> granicus.if.org Git - mutt/commitdiff
Try to make search-next behave more closely to what people are used
authorThomas Roessler <roessler@does-not-exist.org>
Wed, 11 Dec 2002 09:16:25 +0000 (09:16 +0000)
committerThomas Roessler <roessler@does-not-exist.org>
Wed, 11 Dec 2002 09:16:25 +0000 (09:16 +0000)
to, again.  The behaviour introduced by this patch will give you the
previous search string as the default, but will search-next when you
just press enter without changing the search string.

pager.c

diff --git a/pager.c b/pager.c
index 7f6c735c0f5027ee5ab2f2cbe3ee6d426a840266..54c91833655d2e827587f8a3de2990fb695da673 100644 (file)
--- a/pager.c
+++ b/pager.c
@@ -1954,13 +1954,13 @@ search_next:
 
       case OP_SEARCH:
       case OP_SEARCH_REVERSE:
-       buffer[0] = 0;
+        strfcpy (buffer, searchbuf, sizeof (buffer));
        if (mutt_get_field ((SearchBack ? _("Reverse search: ") :
                          _("Search: ")), buffer, sizeof (buffer),
                          M_CLEAR) != 0)
          break;
 
-       if (!buffer[0])
+       if (!strcmp (buffer, searchbuf))
        {
          if (SearchCompiled)
          {
@@ -1972,13 +1972,11 @@ search_next:
 
            goto search_next;
          }
-         /*
-          * preserve old behavior of doing nothing if there is no last
-          * used pattern.
-          */
-         break;
        }
-
+      
+        if (!buffer[0])
+         break;
+      
        strfcpy (searchbuf, buffer, sizeof (searchbuf));
 
        /* leave SearchBack alone if ch == OP_SEARCH_NEXT */