~ubuntu-dev/ubuntu/lucid/mutt/lucid-201002110857

« back to all changes in this revision

Viewing changes to pager.c

  • Committer: Bazaar Package Importer
  • Author(s): Bhavani Shankar
  • Date: 2009-06-07 17:30:03 UTC
  • mto: (16.2.1 experimental) (2.3.1 squeeze)
  • mto: This revision was merged to the branch mainline in revision 21.
  • Revision ID: james.westby@ubuntu.com-20090607173003-rg37ui3h2bbv7wl0
Tags: upstream-1.5.19
ImportĀ upstreamĀ versionĀ 1.5.19

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
 
 * Copyright (C) 1996-2002 Michael R. Elkins <me@mutt.org>
 
2
 * Copyright (C) 1996-2002,2007 Michael R. Elkins <me@mutt.org>
3
3
 * 
4
4
 *     This program is free software; you can redistribute it and/or modify
5
5
 *     it under the terms of the GNU General Public License as published by
26
26
#include "keymap.h"
27
27
#include "mutt_menu.h"
28
28
#include "mapping.h"
29
 
#include "sort.h"
30
29
#include "pager.h"
31
30
#include "attach.h"
32
31
#include "mbyte.h"
33
32
 
34
 
#include "mx.h"
35
 
 
36
 
#ifdef USE_IMAP
37
 
#include "imap_private.h"
38
 
#endif
39
 
 
40
33
#include "mutt_crypt.h"
41
34
 
42
35
#include <sys/stat.h>
1106
1099
    if (k == 0)
1107
1100
      k = 1;
1108
1101
 
 
1102
    if (Charset_is_utf8 && (wc == 0x200B || wc == 0xFEFF))
 
1103
    {
 
1104
        dprint (3, (debugfile, "skip zero-width character U+%04X\n", (unsigned short)wc));
 
1105
        continue;
 
1106
    }
 
1107
 
1109
1108
    /* Handle backspace */
1110
1109
    special = 0;
1111
1110
    if (IsWPrint (wc))
1509
1508
  struct q_class_t *QuoteList = NULL;
1510
1509
  int i, j, ch = 0, rc = -1, hideQuoted = 0, q_level = 0, force_redraw = 0;
1511
1510
  int lines = 0, curline = 0, topline = 0, oldtopline = 0, err, first = 1;
1512
 
  int r = -1;
 
1511
  int r = -1, wrapped = 0;
1513
1512
  int redraw = REDRAW_FULL;
1514
1513
  FILE *fp = NULL;
1515
1514
  LOFF_T last_pos = 0, last_offset = 0;
1584
1583
  {
1585
1584
    mutt_curs_set (0);
1586
1585
 
1587
 
#ifdef USE_IMAP
1588
 
    imap_keepalive ();
1589
 
#endif
1590
 
    
1591
1586
    if (redraw & REDRAW_FULL)
1592
1587
    {
1593
1588
      SETCOLOR (MT_COLOR_NORMAL);
1654
1649
        {
1655
1650
          /* only allocate the space if/when we need the index.
1656
1651
             Initialise the menu as per the main index */
1657
 
          index = mutt_new_menu();
1658
 
          index->menu = MENU_MAIN;
 
1652
          index = mutt_new_menu(MENU_MAIN);
1659
1653
          index->make_entry = index_make_entry;
1660
1654
          index->color = index_color;
1661
1655
          index->max = Context->vcount;
1969
1963
      case OP_SEARCH_OPPOSITE:
1970
1964
        if (SearchCompiled)
1971
1965
        {
 
1966
          wrapped = 0;
 
1967
 
1972
1968
search_next:
1973
1969
          if ((!SearchBack && ch==OP_SEARCH_NEXT) ||
1974
1970
              (SearchBack &&ch==OP_SEARCH_OPPOSITE))
1975
1971
          {
1976
1972
            /* searching forward */
1977
 
            for (i = topline + 1; i < lastLine; i++)
 
1973
            for (i = wrapped ? 0 : topline + 1; i < lastLine; i++)
1978
1974
            {
1979
1975
              if ((!hideQuoted || lineInfo[i].type != MT_COLOR_QUOTED) && 
1980
1976
                    !lineInfo[i].continuation && lineInfo[i].search_cnt > 0)
1983
1979
 
1984
1980
            if (i < lastLine)
1985
1981
              topline = i;
 
1982
            else if (wrapped || !option (OPTWRAPSEARCH))
 
1983
              mutt_error _("Not found.");
1986
1984
            else
1987
 
              mutt_error _("Not found.");
 
1985
            {
 
1986
              mutt_message _("Search wrapped to top.");
 
1987
              wrapped = 1;
 
1988
              goto search_next;
 
1989
            }
1988
1990
          }
1989
1991
          else
1990
1992
          {
1991
1993
            /* searching backward */
1992
 
            for (i = topline - 1; i >= 0; i--)
 
1994
            for (i = wrapped ? lastLine : topline - 1; i >= 0; i--)
1993
1995
            {
1994
1996
              if ((!hideQuoted || (has_types && 
1995
1997
                    lineInfo[i].type != MT_COLOR_QUOTED)) && 
1999
2001
 
2000
2002
            if (i >= 0)
2001
2003
              topline = i;
 
2004
            else if (wrapped || !option (OPTWRAPSEARCH))
 
2005
              mutt_error _("Not found.");
2002
2006
            else
2003
 
              mutt_error _("Not found.");
 
2007
            {
 
2008
              mutt_message _("Search wrapped to bottom.");
 
2009
              wrapped = 1;
 
2010
              goto search_next;
 
2011
            }
2004
2012
          }
2005
2013
 
2006
2014
          if (lineInfo[topline].search_cnt > 0)
2028
2036
            else
2029
2037
              ch = OP_SEARCH_OPPOSITE;
2030
2038
 
 
2039
            wrapped = 0;
2031
2040
            goto search_next;
2032
2041
          }
2033
2042
        }
2658
2667
        redraw = REDRAW_FULL;
2659
2668
        break;
2660
2669
 
 
2670
      case OP_WHAT_KEY:
 
2671
        mutt_what_key ();
 
2672
        break;
 
2673
 
2661
2674
      default:
2662
2675
        ch = -1;
2663
2676
        break;