comparison src/search.c @ 504:35cde31bdcbd

updated for version 7.0141
author vimboss
date Mon, 05 Sep 2005 22:11:52 +0000
parents 66080ac5dab7
children a1059cda45f2
comparison
equal deleted inserted replaced
503:c9ec7077a195 504:35cde31bdcbd
31 int, int, FILE *, linenr_T *, long)); 31 int, int, FILE *, linenr_T *, long));
32 #endif 32 #endif
33 #ifdef FEAT_VIMINFO 33 #ifdef FEAT_VIMINFO
34 static void wvsp_one __ARGS((FILE *fp, int idx, char *s, int sc)); 34 static void wvsp_one __ARGS((FILE *fp, int idx, char *s, int sc));
35 #endif 35 #endif
36
37 static char_u *top_bot_msg = (char_u *)N_("search hit TOP, continuing at BOTTOM");
38 static char_u *bot_top_msg = (char_u *)N_("search hit BOTTOM, continuing at TOP");
39 36
40 /* 37 /*
41 * This file contains various searching-related routines. These fall into 38 * This file contains various searching-related routines. These fall into
42 * three groups: 39 * three groups:
43 * 1. string searches (for /, ?, n, and N) 40 * 1. string searches (for /, ?, n, and N)
852 * This message is also remembered in keep_msg for when the screen 849 * This message is also remembered in keep_msg for when the screen
853 * is redrawn. The keep_msg is cleared whenever another message is 850 * is redrawn. The keep_msg is cleared whenever another message is
854 * written. 851 * written.
855 */ 852 */
856 if (dir == BACKWARD) /* start second loop at the other end */ 853 if (dir == BACKWARD) /* start second loop at the other end */
857 {
858 lnum = buf->b_ml.ml_line_count; 854 lnum = buf->b_ml.ml_line_count;
859 if (!shortmess(SHM_SEARCH) && (options & SEARCH_MSG))
860 give_warning((char_u *)_(top_bot_msg), TRUE);
861 }
862 else 855 else
863 {
864 lnum = 1; 856 lnum = 1;
865 if (!shortmess(SHM_SEARCH) && (options & SEARCH_MSG)) 857 if (!shortmess(SHM_SEARCH) && (options & SEARCH_MSG))
866 give_warning((char_u *)_(bot_top_msg), TRUE); 858 give_warning((char_u *)_(dir == BACKWARD
867 } 859 ? top_bot_msg : bot_top_msg), TRUE);
868 } 860 }
869 if (got_int || called_emsg || break_loop) 861 if (got_int || called_emsg || break_loop)
870 break; 862 break;
871 } 863 }
872 while (--count > 0 && found); /* stop after count matches or no match */ 864 while (--count > 0 && found); /* stop after count matches or no match */
2517 * If 'what' is '{' or '}' we go to the next section. 2509 * If 'what' is '{' or '}' we go to the next section.
2518 * If 'both' is TRUE also stop at '}'. 2510 * If 'both' is TRUE also stop at '}'.
2519 * Return TRUE if the next paragraph or section was found. 2511 * Return TRUE if the next paragraph or section was found.
2520 */ 2512 */
2521 int 2513 int
2522 findpar(oap, dir, count, what, both) 2514 findpar(pincl, dir, count, what, both)
2523 oparg_T *oap; 2515 int *pincl; /* Return: TRUE if last char is to be included */
2524 int dir; 2516 int dir;
2525 long count; 2517 long count;
2526 int what; 2518 int what;
2527 int both; 2519 int both;
2528 { 2520 {
2529 linenr_T curr; 2521 linenr_T curr;
2530 int did_skip; /* TRUE after separating lines have been skipped */ 2522 int did_skip; /* TRUE after separating lines have been skipped */
2531 int first; /* TRUE on first line */ 2523 int first; /* TRUE on first line */
2532 int posix = (vim_strchr(p_cpo, CPO_PARA) != NULL); 2524 int posix = (vim_strchr(p_cpo, CPO_PARA) != NULL);
2584 if (curr == curbuf->b_ml.ml_line_count && what != '}') 2576 if (curr == curbuf->b_ml.ml_line_count && what != '}')
2585 { 2577 {
2586 if ((curwin->w_cursor.col = (colnr_T)STRLEN(ml_get(curr))) != 0) 2578 if ((curwin->w_cursor.col = (colnr_T)STRLEN(ml_get(curr))) != 0)
2587 { 2579 {
2588 --curwin->w_cursor.col; 2580 --curwin->w_cursor.col;
2589 oap->inclusive = TRUE; 2581 *pincl = TRUE;
2590 } 2582 }
2591 } 2583 }
2592 else 2584 else
2593 curwin->w_cursor.col = 0; 2585 curwin->w_cursor.col = 0;
2594 return TRUE; 2586 return TRUE;