Changeset 118c919
- Timestamp:
- Sep 21, 2010, 5:33:11 PM (14 years ago)
- Branches:
- master, release-1.10, release-1.7, release-1.8, release-1.9
- Children:
- b120bd3
- Parents:
- 4a41f16
- git-author:
- David Benjamin <davidben@mit.edu> (09/18/10 17:35:30)
- git-committer:
- David Benjamin <davidben@mit.edu> (09/21/10 17:33:11)
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
commands.c
rd2fd2f7 r118c919 2553 2553 2554 2554 if (argc==1 || (argc==2 && !strcmp(argv[1], "-r"))) { 2555 owl_function_search_helper(OWL_SEARCH_CONTINUE, direction); 2555 /* When continuing a search, don't consider the current message. */ 2556 owl_function_search_helper(false, direction); 2556 2557 } else { 2557 2558 owl_function_set_search(buffstart); 2558 owl_function_search_helper( OWL_SEARCH_MATCH_CURRENT, direction);2559 owl_function_search_helper(true, direction); 2559 2560 } 2560 2561 -
functions.c
r4a41f16 r118c919 2894 2894 } 2895 2895 2896 void owl_function_search_helper(int mode, int direction)2896 void owl_function_search_helper(int consider_current, int direction) 2897 2897 { 2898 2898 /* move to a message that contains the string. If direction is … … 2900 2900 * OWL_DIRECTION_UPWARDS then search backwards. 2901 2901 * 2902 * If mode is OWL_SEARCH_MATCH_CURRENTthen it will stay on the2902 * If consider_current is true then it will stay on the 2903 2903 * current message if it contains the string. 2904 2904 */ … … 2917 2917 } 2918 2918 2919 if ( mode == OWL_SEARCH_MATCH_CURRENT) {2919 if (consider_current) { 2920 2920 start=curmsg; 2921 2921 } else if (direction==OWL_DIRECTION_DOWNWARDS) { -
owl.h
r1b8c3f8 r118c919 138 138 #define OWL_DIRECTION_DOWNWARDS 1 139 139 #define OWL_DIRECTION_UPWARDS 2 140 141 #define OWL_SEARCH_MATCH_CURRENT 0142 #define OWL_SEARCH_CONTINUE 1143 140 144 141 #define OWL_LOGGING_DIRECTION_BOTH 0 -
viewwin.c
r4a41f16 r118c919 144 144 char *owl_viewwin_command_search(owl_viewwin *v, int argc, const char *const *argv, const char *buff) 145 145 { 146 int direction, mode;146 int direction, consider_current; 147 147 const char *buffstart; 148 148 … … 155 155 156 156 if (argc==1 || (argc==2 && !strcmp(argv[1], "-r"))) { 157 mode = OWL_SEARCH_CONTINUE;157 consider_current = false; 158 158 } else { 159 159 owl_function_set_search(buffstart); 160 mode = OWL_SEARCH_MATCH_CURRENT;161 } 162 163 if (!owl_viewwin_search(v, owl_global_get_search_re(&g), mode, direction))160 consider_current = true; 161 } 162 163 if (!owl_viewwin_search(v, owl_global_get_search_re(&g), consider_current, direction)) 164 164 owl_function_error("No more matches"); 165 165 return NULL; … … 177 177 owl_function_set_search(line); 178 178 if (!owl_viewwin_search(data->v, owl_global_get_search_re(&g), 179 OWL_SEARCH_MATCH_CURRENT, data->direction))179 true, data->direction)) 180 180 owl_function_error("No matches"); 181 181 } … … 368 368 * found. 369 369 * 370 * If mode is OWL_SEARCH_MATCH_CURRENTthen stay on the current line370 * If consider_current is true then stay on the current line 371 371 * if it matches. 372 372 */ 373 int owl_viewwin_search(owl_viewwin *v, const owl_regex *re, int mode, int direction)373 int owl_viewwin_search(owl_viewwin *v, const owl_regex *re, int consider_current, int direction) 374 374 { 375 375 int start, end, offset; … … 379 379 if (direction == OWL_DIRECTION_DOWNWARDS) { 380 380 offset = owl_fmtext_search(&v->fmtext, re, 381 (mode == OWL_SEARCH_CONTINUE) ? end : start);381 consider_current ? start : end); 382 382 if (offset < 0) 383 383 return 0; … … 391 391 * them. */ 392 392 buf = owl_fmtext_get_text(&v->fmtext); 393 lineend = (mode == OWL_SEARCH_CONTINUE) ? start : end;393 lineend = consider_current ? end : start; 394 394 while (lineend > 0) { 395 395 linestartp = memrchr(buf, '\n', lineend - 1);
Note: See TracChangeset
for help on using the changeset viewer.