Changeset 9c1e61d4


Ignore:
Timestamp:
Sep 18, 2010, 5:07:40 PM (14 years ago)
Author:
David Benjamin <davidben@mit.edu>
Branches:
master, release-1.10, release-1.7, release-1.8, release-1.9
Children:
b6cf72f
Parents:
a728387
git-author:
David Benjamin <davidben@mit.edu> (08/15/10 19:40:03)
git-committer:
David Benjamin <davidben@mit.edu> (09/18/10 17:07:40)
Message:
Add OWL_SEARCH_CONTINUE and OWL_SEARCH_MATCH_CURRENT

Instead of having a confusing mode argument, define more constants.
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • commands.c

    ra728387 r9c1e61d4  
    25382538   
    25392539  if (argc==1 || (argc==2 && !strcmp(argv[1], "-r"))) {
    2540     owl_function_search_helper(1, direction);
     2540    owl_function_search_helper(OWL_SEARCH_CONTINUE, direction);
    25412541  } else {
    25422542    owl_function_set_search(buffstart);
    2543     owl_function_search_helper(0, direction);
     2543    owl_function_search_helper(OWL_SEARCH_MATCH_CURRENT, direction);
    25442544  }
    25452545 
  • functions.c

    ra728387 r9c1e61d4  
    29042904   * OWL_DIRECTION_UPWARDS then search backwards.
    29052905   *
    2906    * If mode==0 then it will stay on the current message if it
    2907    * contains the string.
     2906   * If mode is OWL_SEARCH_MATCH_CURRENT then it will stay on the
     2907   * current message if it contains the string.
    29082908   */
    29092909
     
    29212921  }
    29222922
    2923   if (mode==0) {
     2923  if (mode == OWL_SEARCH_MATCH_CURRENT) {
    29242924    start=curmsg;
    29252925  } else if (direction==OWL_DIRECTION_DOWNWARDS) {
  • owl.h

    r09ceee3 r9c1e61d4  
    138138#define OWL_DIRECTION_DOWNWARDS 1
    139139#define OWL_DIRECTION_UPWARDS   2
     140
     141#define OWL_SEARCH_MATCH_CURRENT 0
     142#define OWL_SEARCH_CONTINUE      1
    140143
    141144#define OWL_LOGGING_DIRECTION_BOTH 0
  • viewwin.c

    r09ceee3 r9c1e61d4  
    300300 * found.
    301301 *
    302  * If mode==0 then stay on the current line if it matches.
     302 * If mode is OWL_SEARCH_MATCH_CURRENT then stay on the current line
     303 * if it matches.
    303304 */
    304305int owl_viewwin_search(owl_viewwin *v, const owl_regex *re, int mode, int direction)
     
    309310  owl_fmtext_line_extents(&v->fmtext, v->topline, &start, &end);
    310311  if (direction == OWL_DIRECTION_DOWNWARDS) {
    311     offset = owl_fmtext_search(&v->fmtext, re, mode ? end : start);
     312    offset = owl_fmtext_search(&v->fmtext, re,
     313                               (mode == OWL_SEARCH_CONTINUE) ? end : start);
    312314    if (offset < 0)
    313315      return 0;
     
    321323     * them. */
    322324    buf = owl_fmtext_get_text(&v->fmtext);
    323     lineend = mode ? start : end;
     325    lineend = (mode == OWL_SEARCH_CONTINUE) ? start : end;
    324326    while (lineend > 0) {
    325327      linestartp = memrchr(buf, '\n', lineend - 1);
Note: See TracChangeset for help on using the changeset viewer.