- Timestamp:
- Sep 21, 2010, 5:33:11 PM (13 years ago)
- Branches:
- master, 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)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.