Mercurial > vim
comparison src/search.c @ 449:3709cf52b9b5 v7.0119
updated for version 7.0119
author | vimboss |
---|---|
date | Fri, 29 Jul 2005 22:36:03 +0000 |
parents | 73f016dbb279 |
children | 3b705e71c7b0 |
comparison
equal
deleted
inserted
replaced
448:dd9db57ee7ce | 449:3709cf52b9b5 |
---|---|
1355 p = skipwhite(ptr); | 1355 p = skipwhite(ptr); |
1356 pos->col = (colnr_T) (p - ptr); | 1356 pos->col = (colnr_T) (p - ptr); |
1357 | 1357 |
1358 /* when adding lines the matching line may be empty but it is not | 1358 /* when adding lines the matching line may be empty but it is not |
1359 * ignored because we are interested in the next line -- Acevedo */ | 1359 * ignored because we are interested in the next line -- Acevedo */ |
1360 if ((continue_status & CONT_ADDING) && !(continue_status & CONT_SOL)) | 1360 if ((compl_cont_status & CONT_ADDING) |
1361 && !(compl_cont_status & CONT_SOL)) | |
1361 { | 1362 { |
1362 if ((p_ic ? MB_STRICMP(p, pat) : STRCMP(p, pat)) == 0) | 1363 if ((p_ic ? MB_STRICMP(p, pat) : STRCMP(p, pat)) == 0) |
1363 return OK; | 1364 return OK; |
1364 } | 1365 } |
1365 else if (*p != NUL) /* ignore empty lines */ | 1366 else if (*p != NUL) /* ignore empty lines */ |
1366 { /* expanding lines or words */ | 1367 { /* expanding lines or words */ |
1367 if ((p_ic ? MB_STRNICMP(p, pat, completion_length) | 1368 if ((p_ic ? MB_STRNICMP(p, pat, compl_length) |
1368 : STRNCMP(p, pat, completion_length)) == 0) | 1369 : STRNCMP(p, pat, compl_length)) == 0) |
1369 return OK; | 1370 return OK; |
1370 } | 1371 } |
1371 } | 1372 } |
1372 return FAIL; | 1373 return FAIL; |
1373 } | 1374 } |
4281 #endif | 4282 #endif |
4282 | 4283 |
4283 #if defined(FEAT_FIND_ID) || defined(PROTO) | 4284 #if defined(FEAT_FIND_ID) || defined(PROTO) |
4284 /* | 4285 /* |
4285 * Find identifiers or defines in included files. | 4286 * Find identifiers or defines in included files. |
4286 * if p_ic && (continue_status & CONT_SOL) then ptr must be in lowercase. | 4287 * if p_ic && (compl_cont_status & CONT_SOL) then ptr must be in lowercase. |
4287 */ | 4288 */ |
4288 /*ARGSUSED*/ | 4289 /*ARGSUSED*/ |
4289 void | 4290 void |
4290 find_pattern_in_path(ptr, dir, len, whole, skip_comments, | 4291 find_pattern_in_path(ptr, dir, len, whole, skip_comments, |
4291 type, count, action, start_lnum, end_lnum) | 4292 type, count, action, start_lnum, end_lnum) |
4351 | 4352 |
4352 if (type != CHECK_PATH && type != FIND_DEFINE | 4353 if (type != CHECK_PATH && type != FIND_DEFINE |
4353 #ifdef FEAT_INS_EXPAND | 4354 #ifdef FEAT_INS_EXPAND |
4354 /* when CONT_SOL is set compare "ptr" with the beginning of the line | 4355 /* when CONT_SOL is set compare "ptr" with the beginning of the line |
4355 * is faster than quote_meta/regcomp/regexec "ptr" -- Acevedo */ | 4356 * is faster than quote_meta/regcomp/regexec "ptr" -- Acevedo */ |
4356 && !(continue_status & CONT_SOL) | 4357 && !(compl_cont_status & CONT_SOL) |
4357 #endif | 4358 #endif |
4358 ) | 4359 ) |
4359 { | 4360 { |
4360 pat = alloc(len + 5); | 4361 pat = alloc(len + 5); |
4361 if (pat == NULL) | 4362 if (pat == NULL) |
4599 */ | 4600 */ |
4600 if (def_regmatch.regprog == NULL || define_matched) | 4601 if (def_regmatch.regprog == NULL || define_matched) |
4601 { | 4602 { |
4602 if (define_matched | 4603 if (define_matched |
4603 #ifdef FEAT_INS_EXPAND | 4604 #ifdef FEAT_INS_EXPAND |
4604 || (continue_status & CONT_SOL) | 4605 || (compl_cont_status & CONT_SOL) |
4605 #endif | 4606 #endif |
4606 ) | 4607 ) |
4607 { | 4608 { |
4608 /* compare the first "len" chars from "ptr" */ | 4609 /* compare the first "len" chars from "ptr" */ |
4609 startp = skipwhite(p); | 4610 startp = skipwhite(p); |
4677 | 4678 |
4678 if (depth == -1 && lnum == curwin->w_cursor.lnum) | 4679 if (depth == -1 && lnum == curwin->w_cursor.lnum) |
4679 break; | 4680 break; |
4680 found = TRUE; | 4681 found = TRUE; |
4681 aux = p = startp; | 4682 aux = p = startp; |
4682 if (continue_status & CONT_ADDING) | 4683 if (compl_cont_status & CONT_ADDING) |
4683 { | 4684 { |
4684 p += completion_length; | 4685 p += compl_length; |
4685 if (vim_iswordp(p)) | 4686 if (vim_iswordp(p)) |
4686 goto exit_matched; | 4687 goto exit_matched; |
4687 p = find_word_start(p); | 4688 p = find_word_start(p); |
4688 } | 4689 } |
4689 p = find_word_end(p); | 4690 p = find_word_end(p); |
4690 i = (int)(p - aux); | 4691 i = (int)(p - aux); |
4691 | 4692 |
4692 if ((continue_status & CONT_ADDING) && i == completion_length) | 4693 if ((compl_cont_status & CONT_ADDING) && i == compl_length) |
4693 { | 4694 { |
4694 /* get the next line */ | 4695 /* get the next line */ |
4695 /* IOSIZE > completion_length, so the STRNCPY works */ | 4696 /* IOSIZE > compl_length, so the STRNCPY works */ |
4696 STRNCPY(IObuff, aux, i); | 4697 STRNCPY(IObuff, aux, i); |
4697 if (!( depth < 0 | 4698 if (!( depth < 0 |
4698 && lnum < end_lnum | 4699 && lnum < end_lnum |
4699 && (line = ml_get(++lnum)) != NULL) | 4700 && (line = ml_get(++lnum)) != NULL) |
4700 && !( depth >= 0 | 4701 && !( depth >= 0 |
4730 reuse |= CONT_S_IPOS; | 4731 reuse |= CONT_S_IPOS; |
4731 } | 4732 } |
4732 IObuff[i] = NUL; | 4733 IObuff[i] = NUL; |
4733 aux = IObuff; | 4734 aux = IObuff; |
4734 | 4735 |
4735 if (i == completion_length) | 4736 if (i == compl_length) |
4736 goto exit_matched; | 4737 goto exit_matched; |
4737 } | 4738 } |
4738 | 4739 |
4739 add_r = ins_compl_add_infercase(aux, i, | 4740 add_r = ins_compl_add_infercase(aux, i, |
4740 curr_fname == curbuf->b_fname ? NULL : curr_fname, | 4741 curr_fname == curbuf->b_fname ? NULL : curr_fname, |
4862 /* look for other matches in the rest of the line if we | 4863 /* look for other matches in the rest of the line if we |
4863 * are not at the end of it already */ | 4864 * are not at the end of it already */ |
4864 if (def_regmatch.regprog == NULL | 4865 if (def_regmatch.regprog == NULL |
4865 #ifdef FEAT_INS_EXPAND | 4866 #ifdef FEAT_INS_EXPAND |
4866 && action == ACTION_EXPAND | 4867 && action == ACTION_EXPAND |
4867 && !(continue_status & CONT_SOL) | 4868 && !(compl_cont_status & CONT_SOL) |
4868 #endif | 4869 #endif |
4869 && *(p = startp + 1)) | 4870 && *(p = startp + 1)) |
4870 goto search_line; | 4871 goto search_line; |
4871 } | 4872 } |
4872 line_breakcheck(); | 4873 line_breakcheck(); |
4873 #ifdef FEAT_INS_EXPAND | 4874 #ifdef FEAT_INS_EXPAND |
4874 if (action == ACTION_EXPAND) | 4875 if (action == ACTION_EXPAND) |
4875 ins_compl_check_keys(); | 4876 ins_compl_check_keys(); |
4876 if (got_int || completion_interrupted) | 4877 if (got_int || compl_interrupted) |
4877 #else | 4878 #else |
4878 if (got_int) | 4879 if (got_int) |
4879 #endif | 4880 #endif |
4880 break; | 4881 break; |
4881 | 4882 |
4934 && action != ACTION_EXPAND | 4935 && action != ACTION_EXPAND |
4935 #endif | 4936 #endif |
4936 ) | 4937 ) |
4937 { | 4938 { |
4938 #ifdef FEAT_INS_EXPAND | 4939 #ifdef FEAT_INS_EXPAND |
4939 if (got_int || completion_interrupted) | 4940 if (got_int || compl_interrupted) |
4940 #else | 4941 #else |
4941 if (got_int) | 4942 if (got_int) |
4942 #endif | 4943 #endif |
4943 EMSG(_(e_interr)); | 4944 EMSG(_(e_interr)); |
4944 else if (type == FIND_DEFINE) | 4945 else if (type == FIND_DEFINE) |