<<< Date Index >>>     <<< Thread Index >>>

Re: [Mutt] #3127: Hangup when searching for failed pattern



#3127: Hangup when searching for failed pattern
---------------------+------------------------------------------------------
  Reporter:  vinc17  |       Owner:  mutt-dev
      Type:  defect  |      Status:  new     
  Priority:  major   |   Milestone:          
 Component:  mutt    |     Version:          
Resolution:          |    Keywords:          
---------------------+------------------------------------------------------

Comment(by TAKAHASHI Tamotsu):

 {{{
 Perhaps this is what Rocco meant:

 diff -r 10a1f06bc8aa pager.c
 --- a/pager.c   Tue Oct 07 19:22:53 2008 -0700
 +++ b/pager.c   Sun Oct 19 13:19:48 2008 +0900
 @@ -1511,7 +1511,7 @@
    struct q_class_t *QuoteList = NULL;
    int i, j, ch = 0, rc = -1, hideQuoted = 0, q_level = 0, force_redraw =
 0;
    int lines = 0, curline = 0, topline = 0, oldtopline = 0, err, first =
 1;
 -  int r = -1;
 +  int r = -1, wrapped = 0;
    int redraw = REDRAW_FULL;
    FILE *fp = NULL;
    LOFF_T last_pos = 0, last_offset = 0;
 @@ -1967,12 +1967,14 @@
        case OP_SEARCH_OPPOSITE:
         if (SearchCompiled)
         {
 +         wrapped = 0;
 +
  search_next:
           if ((!SearchBack && ch==OP_SEARCH_NEXT) ||
               (SearchBack &&ch==OP_SEARCH_OPPOSITE))
           {
             /* searching forward */
 -           for (i = topline + 1; i < lastLine; i++)
 +           for (i = wrapped ? 0 : topline + 1; i < lastLine; i++)
             {
               if ((!hideQuoted || lineInfo[i].type != MT_COLOR_QUOTED) &&
                     !lineInfo[i].continuation && lineInfo[i].search_cnt >
 0)
 @@ -1981,19 +1983,19 @@

             if (i < lastLine)
               topline = i;
 -           else if (!option (OPTWRAPSEARCH))
 +           else if (wrapped || !option (OPTWRAPSEARCH))
               mutt_error _("Not found.");
             else
             {
               mutt_message _("Search wrapped to top.");
 -             topline = 1;
 +             wrapped = 1;
               goto search_next;
             }
           }
           else
           {
             /* searching backward */
 -           for (i = topline - 1; i >= 0; i--)
 +           for (i = wrapped ? lastLine : topline - 1; i >= 0; i--)
             {
               if ((!hideQuoted || (has_types &&
                     lineInfo[i].type != MT_COLOR_QUOTED)) &&
 @@ -2003,12 +2005,12 @@

             if (i >= 0)
               topline = i;
 -           else if (!option (OPTWRAPSEARCH))
 +           else if (wrapped || !option (OPTWRAPSEARCH))
               mutt_error _("Not found.");
             else
             {
               mutt_message _("Search wrapped to bottom.");
 -             topline = lastLine - 1;
 +             wrapped = 1;
               goto search_next;
             }
           }
 @@ -2038,6 +2040,7 @@
             else
               ch = OP_SEARCH_OPPOSITE;

 +           wrapped = 0;
             goto search_next;
           }
         }
 }}}

-- 
Ticket URL: <http://dev.mutt.org/trac/ticket/3127#comment:>
Mutt <http://www.mutt.org/>
The Mutt mail user agent