Mirror of the Vim source from https://github.com/vim/vim
リビジョン | cc4fe241baa3596ae9cd27ce65ad25077bfb2e71 (tree) |
---|---|
日時 | 2008-01-19 23:59:58 |
作者 | vimboss |
コミッター | vimboss |
updated for version 7.1-236
@@ -3618,6 +3618,7 @@ | ||
3618 | 3618 | When you get bored looking at the highlighted matches, you can turn it |
3619 | 3619 | off with |:nohlsearch|. As soon as you use a search command, the |
3620 | 3620 | highlighting comes back. |
3621 | + 'redrawtime' specifies the maximum time spend on finding matches. | |
3621 | 3622 | When the search pattern can match an end-of-line, Vim will try to |
3622 | 3623 | highlight all of the matched text. However, this depends on where the |
3623 | 3624 | search starts. This will be the first line in the window or the first |
@@ -3851,6 +3852,10 @@ | ||
3851 | 3852 | original position when no match is found and when pressing <Esc>. You |
3852 | 3853 | still need to finish the search command with <Enter> to move the |
3853 | 3854 | cursor to the match. |
3855 | + When compiled with the |+reltime| feature Vim only searches for about | |
3856 | + half a second. With a complicated pattern and/or a lot of text the | |
3857 | + match may not be found. This is to avoid that Vim hangs while you | |
3858 | + are typing the pattern. | |
3854 | 3859 | The highlighting can be set with the 'i' flag in 'highlight'. |
3855 | 3860 | See also: 'hlsearch'. |
3856 | 3861 | CTRL-L can be used to add one character from after the current match |
@@ -5185,6 +5190,18 @@ | ||
5185 | 5190 | {not in Vi:} When using the ":view" command the 'readonly' option is |
5186 | 5191 | set for the newly edited buffer. |
5187 | 5192 | |
5193 | + *'redrawtime'* *'rdt'* | |
5194 | +'redrawtime' 'rdt' number (default 2000) | |
5195 | + global | |
5196 | + {not in Vi} | |
5197 | + {only available when compiled with the |+reltime| | |
5198 | + feature} | |
5199 | + The time in milliseconds for redrawing the display. This applies to | |
5200 | + searching for patterns for 'hlsearch' and |:match| highlighting. | |
5201 | + When redrawing takes more than this many milliseconds no further | |
5202 | + matches will be highlighted. This is used to avoid that Vim hangs | |
5203 | + when using a very complicated pattern. | |
5204 | + | |
5188 | 5205 | *'remap'* *'noremap'* |
5189 | 5206 | 'remap' boolean (default on) |
5190 | 5207 | global |
@@ -4446,7 +4446,8 @@ | ||
4446 | 4446 | #endif |
4447 | 4447 | ); ++lnum) |
4448 | 4448 | { |
4449 | - nmatch = vim_regexec_multi(®match, curwin, curbuf, lnum, (colnr_T)0); | |
4449 | + nmatch = vim_regexec_multi(®match, curwin, curbuf, lnum, | |
4450 | + (colnr_T)0, NULL); | |
4450 | 4451 | if (nmatch) |
4451 | 4452 | { |
4452 | 4453 | colnr_T copycol; |
@@ -4957,7 +4958,8 @@ | ||
4957 | 4958 | || (do_ask && !re_lookbehind(regmatch.regprog)) |
4958 | 4959 | || nmatch_tl > 0 |
4959 | 4960 | || (nmatch = vim_regexec_multi(®match, curwin, |
4960 | - curbuf, sub_firstlnum, matchcol)) == 0 | |
4961 | + curbuf, sub_firstlnum, | |
4962 | + matchcol, NULL)) == 0 | |
4961 | 4963 | || regmatch.startpos[0].lnum > 0) |
4962 | 4964 | { |
4963 | 4965 | if (new_start != NULL) |
@@ -5022,7 +5024,7 @@ | ||
5022 | 5024 | } |
5023 | 5025 | if (nmatch == -1 && !lastone) |
5024 | 5026 | nmatch = vim_regexec_multi(®match, curwin, curbuf, |
5025 | - sub_firstlnum, matchcol); | |
5027 | + sub_firstlnum, matchcol, NULL); | |
5026 | 5028 | |
5027 | 5029 | /* |
5028 | 5030 | * 5. break if there isn't another match in this line |
@@ -5252,7 +5254,8 @@ | ||
5252 | 5254 | for (lnum = eap->line1; lnum <= eap->line2 && !got_int; ++lnum) |
5253 | 5255 | { |
5254 | 5256 | /* a match on this line? */ |
5255 | - match = vim_regexec_multi(®match, curwin, curbuf, lnum, (colnr_T)0); | |
5257 | + match = vim_regexec_multi(®match, curwin, curbuf, lnum, | |
5258 | + (colnr_T)0, NULL); | |
5256 | 5259 | if ((type == 'g' && match) || (type == 'v' && !match)) |
5257 | 5260 | { |
5258 | 5261 | ml_setmarked(lnum); |
@@ -3931,7 +3931,8 @@ | ||
3931 | 3931 | curwin->w_cursor.col = 0; |
3932 | 3932 | searchcmdlen = 0; |
3933 | 3933 | if (!do_search(NULL, c, cmd, 1L, |
3934 | - SEARCH_HIS + SEARCH_MSG + SEARCH_START)) | |
3934 | + SEARCH_HIS + SEARCH_MSG + SEARCH_START, | |
3935 | + NULL)) | |
3935 | 3936 | { |
3936 | 3937 | curwin->w_cursor = pos; |
3937 | 3938 | cmd = NULL; |
@@ -1709,6 +1709,9 @@ | ||
1709 | 1709 | if (p_is && !cmd_silent && (firstc == '/' || firstc == '?')) |
1710 | 1710 | { |
1711 | 1711 | pos_T end_pos; |
1712 | +#ifdef FEAT_RELTIME | |
1713 | + proftime_T tm; | |
1714 | +#endif | |
1712 | 1715 | |
1713 | 1716 | /* if there is a character waiting, search and redraw later */ |
1714 | 1717 | if (char_avail()) |
@@ -1727,8 +1730,18 @@ | ||
1727 | 1730 | cursor_off(); /* so the user knows we're busy */ |
1728 | 1731 | out_flush(); |
1729 | 1732 | ++emsg_off; /* So it doesn't beep if bad expr */ |
1733 | +#ifdef FEAT_RELTIME | |
1734 | + /* Set the time limit to half a second. */ | |
1735 | + profile_setlimit(500L, &tm); | |
1736 | +#endif | |
1730 | 1737 | i = do_search(NULL, firstc, ccline.cmdbuff, count, |
1731 | - SEARCH_KEEP + SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK); | |
1738 | + SEARCH_KEEP + SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK, | |
1739 | +#ifdef FEAT_RELTIME | |
1740 | + &tm | |
1741 | +#else | |
1742 | + NULL | |
1743 | +#endif | |
1744 | + ); | |
1732 | 1745 | --emsg_off; |
1733 | 1746 | /* if interrupted while searching, behave like it failed */ |
1734 | 1747 | if (got_int) |
@@ -5052,7 +5052,7 @@ | ||
5052 | 5052 | /* Search for the next match. */ |
5053 | 5053 | i = msg_scroll; |
5054 | 5054 | do_search(NULL, down ? '/' : '?', ga.ga_data, 1L, |
5055 | - SEARCH_MSG + SEARCH_MARK); | |
5055 | + SEARCH_MSG + SEARCH_MARK, NULL); | |
5056 | 5056 | msg_scroll = i; /* don't let an error message set msg_scroll */ |
5057 | 5057 | } |
5058 | 5058 |
@@ -437,7 +437,8 @@ | ||
437 | 437 | { |
438 | 438 | regmatch.rmm_ic = FALSE; |
439 | 439 | regmatch.rmm_maxcol = 0; |
440 | - if (vim_regexec_multi(®match, curwin, curbuf, lnum, (colnr_T)0)) | |
440 | + if (vim_regexec_multi(®match, curwin, curbuf, lnum, | |
441 | + (colnr_T)0, NULL)) | |
441 | 442 | { |
442 | 443 | pos.lnum = regmatch.endpos[0].lnum + lnum; |
443 | 444 | pos.col = regmatch.endpos[0].col; |
@@ -6093,7 +6093,7 @@ | ||
6093 | 6093 | curwin->w_set_curswant = TRUE; |
6094 | 6094 | |
6095 | 6095 | i = do_search(cap->oap, dir, pat, cap->count1, |
6096 | - opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG); | |
6096 | + opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, NULL); | |
6097 | 6097 | if (i == 0) |
6098 | 6098 | clearop(cap->oap); |
6099 | 6099 | else |
@@ -1991,6 +1991,13 @@ | ||
1991 | 1991 | {"redraw", NULL, P_BOOL|P_VI_DEF, |
1992 | 1992 | (char_u *)NULL, PV_NONE, |
1993 | 1993 | {(char_u *)FALSE, (char_u *)0L}}, |
1994 | + {"redrawtime", "rdt", P_NUM|P_VI_DEF, | |
1995 | +#ifdef FEAT_RELTIME | |
1996 | + (char_u *)&p_rdt, PV_NONE, | |
1997 | +#else | |
1998 | + (char_u *)NULL, PV_NONE, | |
1999 | +#endif | |
2000 | + {(char_u *)2000L, (char_u *)0L}}, | |
1994 | 2001 | {"remap", NULL, P_BOOL|P_VI_DEF, |
1995 | 2002 | (char_u *)&p_remap, PV_NONE, |
1996 | 2003 | {(char_u *)TRUE, (char_u *)0L}}, |
@@ -633,6 +633,9 @@ | ||
633 | 633 | #ifdef FEAT_SEARCHPATH |
634 | 634 | EXTERN char_u *p_cdpath; /* 'cdpath' */ |
635 | 635 | #endif |
636 | +#ifdef FEAT_RELTIME | |
637 | +EXTERN long p_rdt; /* 'redrawtime' */ | |
638 | +#endif | |
636 | 639 | EXTERN int p_remap; /* 'remap' */ |
637 | 640 | EXTERN long p_report; /* 'report' */ |
638 | 641 | #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX) |
@@ -1,13 +1,13 @@ | ||
1 | 1 | /* regexp.c */ |
2 | -void free_regexp_stuff __ARGS((void)); | |
3 | 2 | int re_multiline __ARGS((regprog_T *prog)); |
4 | 3 | int re_lookbehind __ARGS((regprog_T *prog)); |
5 | 4 | char_u *skip_regexp __ARGS((char_u *startp, int dirc, int magic, char_u **newp)); |
6 | 5 | regprog_T *vim_regcomp __ARGS((char_u *expr, int re_flags)); |
7 | 6 | int vim_regcomp_had_eol __ARGS((void)); |
7 | +void free_regexp_stuff __ARGS((void)); | |
8 | 8 | int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col)); |
9 | 9 | int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col)); |
10 | -long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col)); | |
10 | +long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm)); | |
11 | 11 | reg_extmatch_T *ref_extmatch __ARGS((reg_extmatch_T *em)); |
12 | 12 | void unref_extmatch __ARGS((reg_extmatch_T *em)); |
13 | 13 | char_u *regtilde __ARGS((char_u *source, int magic)); |
@@ -11,7 +11,7 @@ | ||
11 | 11 | void set_last_search_pat __ARGS((char_u *s, int idx, int magic, int setlast)); |
12 | 12 | void last_pat_prog __ARGS((regmmatch_T *regmatch)); |
13 | 13 | int searchit __ARGS((win_T *win, buf_T *buf, pos_T *pos, int dir, char_u *pat, long count, int options, int pat_use, linenr_T stop_lnum, proftime_T *tm)); |
14 | -int do_search __ARGS((oparg_T *oap, int dirc, char_u *pat, long count, int options)); | |
14 | +int do_search __ARGS((oparg_T *oap, int dirc, char_u *pat, long count, int options, proftime_T *tm)); | |
15 | 15 | int search_for_exact_line __ARGS((buf_T *buf, pos_T *pos, int dir, char_u *pat)); |
16 | 16 | int searchc __ARGS((cmdarg_T *cap, int t_cmd)); |
17 | 17 | pos_T *findmatch __ARGS((oparg_T *oap, int initc)); |
@@ -1803,7 +1803,8 @@ | ||
1803 | 1803 | /* Move the cursor to the first line in the buffer */ |
1804 | 1804 | save_cursor = curwin->w_cursor; |
1805 | 1805 | curwin->w_cursor.lnum = 0; |
1806 | - if (!do_search(NULL, '/', qf_ptr->qf_pattern, (long)1, SEARCH_KEEP)) | |
1806 | + if (!do_search(NULL, '/', qf_ptr->qf_pattern, (long)1, | |
1807 | + SEARCH_KEEP, NULL)) | |
1807 | 1808 | curwin->w_cursor = save_cursor; |
1808 | 1809 | } |
1809 | 1810 |
@@ -3159,7 +3160,7 @@ | ||
3159 | 3160 | { |
3160 | 3161 | col = 0; |
3161 | 3162 | while (vim_regexec_multi(®match, curwin, buf, lnum, |
3162 | - col) > 0) | |
3163 | + col, NULL) > 0) | |
3163 | 3164 | { |
3164 | 3165 | ; |
3165 | 3166 | if (qf_add_entry(qi, &prevp, |
@@ -3040,7 +3040,7 @@ | ||
3040 | 3040 | } save_se_T; |
3041 | 3041 | |
3042 | 3042 | static char_u *reg_getline __ARGS((linenr_T lnum)); |
3043 | -static long vim_regexec_both __ARGS((char_u *line, colnr_T col)); | |
3043 | +static long vim_regexec_both __ARGS((char_u *line, colnr_T col, proftime_T *tm)); | |
3044 | 3044 | static long regtry __ARGS((regprog_T *prog, colnr_T col)); |
3045 | 3045 | static void cleanup_subexpr __ARGS((void)); |
3046 | 3046 | #ifdef FEAT_SYN_HL |
@@ -3284,7 +3284,7 @@ | ||
3284 | 3284 | ireg_icombine = FALSE; |
3285 | 3285 | #endif |
3286 | 3286 | ireg_maxcol = 0; |
3287 | - return (vim_regexec_both(line, col) != 0); | |
3287 | + return (vim_regexec_both(line, col, NULL) != 0); | |
3288 | 3288 | } |
3289 | 3289 | |
3290 | 3290 | #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \ |
@@ -3308,7 +3308,7 @@ | ||
3308 | 3308 | ireg_icombine = FALSE; |
3309 | 3309 | #endif |
3310 | 3310 | ireg_maxcol = 0; |
3311 | - return (vim_regexec_both(line, col) != 0); | |
3311 | + return (vim_regexec_both(line, col, NULL) != 0); | |
3312 | 3312 | } |
3313 | 3313 | #endif |
3314 | 3314 |
@@ -3321,12 +3321,13 @@ | ||
3321 | 3321 | * match otherwise. |
3322 | 3322 | */ |
3323 | 3323 | long |
3324 | -vim_regexec_multi(rmp, win, buf, lnum, col) | |
3324 | +vim_regexec_multi(rmp, win, buf, lnum, col, tm) | |
3325 | 3325 | regmmatch_T *rmp; |
3326 | 3326 | win_T *win; /* window in which to search or NULL */ |
3327 | 3327 | buf_T *buf; /* buffer in which to search */ |
3328 | 3328 | linenr_T lnum; /* nr of line to start looking for match */ |
3329 | 3329 | colnr_T col; /* column to start looking for match */ |
3330 | + proftime_T *tm; /* timeout limit or NULL */ | |
3330 | 3331 | { |
3331 | 3332 | long r; |
3332 | 3333 | buf_T *save_curbuf = curbuf; |
@@ -3346,7 +3347,7 @@ | ||
3346 | 3347 | |
3347 | 3348 | /* Need to switch to buffer "buf" to make vim_iswordc() work. */ |
3348 | 3349 | curbuf = buf; |
3349 | - r = vim_regexec_both(NULL, col); | |
3350 | + r = vim_regexec_both(NULL, col, tm); | |
3350 | 3351 | curbuf = save_curbuf; |
3351 | 3352 | |
3352 | 3353 | return r; |
@@ -3356,10 +3357,12 @@ | ||
3356 | 3357 | * Match a regexp against a string ("line" points to the string) or multiple |
3357 | 3358 | * lines ("line" is NULL, use reg_getline()). |
3358 | 3359 | */ |
3360 | +/*ARGSUSED*/ | |
3359 | 3361 | static long |
3360 | -vim_regexec_both(line, col) | |
3362 | +vim_regexec_both(line, col, tm) | |
3361 | 3363 | char_u *line; |
3362 | 3364 | colnr_T col; /* column to start looking for match */ |
3365 | + proftime_T *tm; /* timeout limit or NULL */ | |
3363 | 3366 | { |
3364 | 3367 | regprog_T *prog; |
3365 | 3368 | char_u *s; |
@@ -3502,6 +3505,9 @@ | ||
3502 | 3505 | } |
3503 | 3506 | else |
3504 | 3507 | { |
3508 | +#ifdef FEAT_RELTIME | |
3509 | + int tm_count = 0; | |
3510 | +#endif | |
3505 | 3511 | /* Messy cases: unanchored match. */ |
3506 | 3512 | while (!got_int) |
3507 | 3513 | { |
@@ -3550,6 +3556,15 @@ | ||
3550 | 3556 | else |
3551 | 3557 | #endif |
3552 | 3558 | ++col; |
3559 | +#ifdef FEAT_RELTIME | |
3560 | + /* Check for timeout once in a twenty times to avoid overhead. */ | |
3561 | + if (tm != NULL && ++tm_count == 20) | |
3562 | + { | |
3563 | + tm_count = 0; | |
3564 | + if (profile_passed_limit(tm)) | |
3565 | + break; | |
3566 | + } | |
3567 | +#endif | |
3553 | 3568 | } |
3554 | 3569 | } |
3555 | 3570 |
@@ -848,11 +848,16 @@ | ||
848 | 848 | cur->hl.buf = buf; |
849 | 849 | cur->hl.lnum = 0; |
850 | 850 | cur->hl.first_lnum = 0; |
851 | +# ifdef FEAT_RELTIME | |
852 | + /* Set the time limit to 'redrawtime'. */ | |
853 | + profile_setlimit(p_rdt, &(cur->hl.tm)); | |
854 | +# endif | |
851 | 855 | cur = cur->next; |
852 | 856 | } |
853 | 857 | search_hl.buf = buf; |
854 | 858 | search_hl.lnum = 0; |
855 | 859 | search_hl.first_lnum = 0; |
860 | + /* time limit is set at the toplevel, for all windows */ | |
856 | 861 | #endif |
857 | 862 | |
858 | 863 | #ifdef FEAT_LINEBREAK |
@@ -6462,6 +6467,10 @@ | ||
6462 | 6467 | { |
6463 | 6468 | last_pat_prog(&search_hl.rm); |
6464 | 6469 | search_hl.attr = hl_attr(HLF_L); |
6470 | +# ifdef FEAT_RELTIME | |
6471 | + /* Set the time limit to 'redrawtime'. */ | |
6472 | + profile_setlimit(p_rdt, &search_hl.tm); | |
6473 | +# endif | |
6465 | 6474 | } |
6466 | 6475 | } |
6467 | 6476 |
@@ -6587,6 +6596,14 @@ | ||
6587 | 6596 | called_emsg = FALSE; |
6588 | 6597 | for (;;) |
6589 | 6598 | { |
6599 | +#ifdef FEAT_RELTIME | |
6600 | + /* Stop searching after passing the time limit. */ | |
6601 | + if (profile_passed_limit(&(shl->tm))) | |
6602 | + { | |
6603 | + shl->lnum = 0; /* no match found in time */ | |
6604 | + break; | |
6605 | + } | |
6606 | +#endif | |
6590 | 6607 | /* Three situations: |
6591 | 6608 | * 1. No useful previous match: search from start of line. |
6592 | 6609 | * 2. Not Vi compatible or empty match: continue at next character. |
@@ -6620,7 +6637,13 @@ | ||
6620 | 6637 | matchcol = shl->rm.endpos[0].col; |
6621 | 6638 | |
6622 | 6639 | shl->lnum = lnum; |
6623 | - nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol); | |
6640 | + nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol, | |
6641 | +#ifdef FEAT_RELTIME | |
6642 | + &(shl->tm) | |
6643 | +#else | |
6644 | + NULL | |
6645 | +#endif | |
6646 | + ); | |
6624 | 6647 | if (called_emsg) |
6625 | 6648 | { |
6626 | 6649 | /* Error while handling regexp: stop using this regexp. */ |
@@ -606,7 +606,13 @@ | ||
606 | 606 | * Look for a match somewhere in line "lnum". |
607 | 607 | */ |
608 | 608 | nmatched = vim_regexec_multi(®match, win, buf, |
609 | - lnum, (colnr_T)0); | |
609 | + lnum, (colnr_T)0, | |
610 | +#ifdef FEAT_RELTIME | |
611 | + tm | |
612 | +#else | |
613 | + NULL | |
614 | +#endif | |
615 | + ); | |
610 | 616 | /* Abort searching on an error (e.g., out of stack). */ |
611 | 617 | if (called_emsg) |
612 | 618 | break; |
@@ -615,9 +621,9 @@ | ||
615 | 621 | /* match may actually be in another line when using \zs */ |
616 | 622 | matchpos = regmatch.startpos[0]; |
617 | 623 | endpos = regmatch.endpos[0]; |
618 | -# ifdef FEAT_EVAL | |
624 | +#ifdef FEAT_EVAL | |
619 | 625 | submatch = first_submatch(®match); |
620 | -# endif | |
626 | +#endif | |
621 | 627 | /* Line me be past end of buffer for "\n\zs". */ |
622 | 628 | if (lnum + matchpos.lnum > buf->b_ml.ml_line_count) |
623 | 629 | ptr = (char_u *)""; |
@@ -693,7 +699,13 @@ | ||
693 | 699 | if (ptr[matchcol] == NUL |
694 | 700 | || (nmatched = vim_regexec_multi(®match, |
695 | 701 | win, buf, lnum + matchpos.lnum, |
696 | - matchcol)) == 0) | |
702 | + matchcol, | |
703 | +#ifdef FEAT_RELTIME | |
704 | + tm | |
705 | +#else | |
706 | + NULL | |
707 | +#endif | |
708 | + )) == 0) | |
697 | 709 | { |
698 | 710 | match_ok = FALSE; |
699 | 711 | break; |
@@ -799,7 +811,13 @@ | ||
799 | 811 | if (ptr[matchcol] == NUL |
800 | 812 | || (nmatched = vim_regexec_multi(®match, |
801 | 813 | win, buf, lnum + matchpos.lnum, |
802 | - matchcol)) == 0) | |
814 | + matchcol, | |
815 | +#ifdef FEAT_RELTIME | |
816 | + tm | |
817 | +#else | |
818 | + NULL | |
819 | +#endif | |
820 | + )) == 0) | |
803 | 821 | break; |
804 | 822 | |
805 | 823 | /* Need to get the line pointer again, a |
@@ -977,12 +995,13 @@ | ||
977 | 995 | * return 0 for failure, 1 for found, 2 for found and line offset added |
978 | 996 | */ |
979 | 997 | int |
980 | -do_search(oap, dirc, pat, count, options) | |
998 | +do_search(oap, dirc, pat, count, options, tm) | |
981 | 999 | oparg_T *oap; /* can be NULL */ |
982 | 1000 | int dirc; /* '/' or '?' */ |
983 | 1001 | char_u *pat; |
984 | 1002 | long count; |
985 | 1003 | int options; |
1004 | + proftime_T *tm; /* timeout limit or NULL */ | |
986 | 1005 | { |
987 | 1006 | pos_T pos; /* position of the last match */ |
988 | 1007 | char_u *searchstr; |
@@ -1256,7 +1275,7 @@ | ||
1256 | 1275 | (SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS |
1257 | 1276 | + SEARCH_MSG + SEARCH_START |
1258 | 1277 | + ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))), |
1259 | - RE_LAST, (linenr_T)0, NULL); | |
1278 | + RE_LAST, (linenr_T)0, tm); | |
1260 | 1279 | |
1261 | 1280 | if (dircp != NULL) |
1262 | 1281 | *dircp = dirc; /* restore second '/' or '?' for normal_cmd() */ |
@@ -10343,7 +10343,7 @@ | ||
10343 | 10343 | curwin->w_cursor.lnum = 0; |
10344 | 10344 | while (!got_int) |
10345 | 10345 | { |
10346 | - if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP) == 0 | |
10346 | + if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP, NULL) == 0 | |
10347 | 10347 | || u_save_cursor() == FAIL) |
10348 | 10348 | break; |
10349 | 10349 |
@@ -1717,6 +1717,9 @@ | ||
1717 | 1717 | linenr_T first_lnum; /* first lnum to search for multi-line pat */ |
1718 | 1718 | colnr_T startcol; /* in win_line() points to char where HL starts */ |
1719 | 1719 | colnr_T endcol; /* in win_line() points to char where HL ends */ |
1720 | +#ifdef FEAT_RELTIME | |
1721 | + proftime_T tm; /* for a time limit */ | |
1722 | +#endif | |
1720 | 1723 | } match_T; |
1721 | 1724 | |
1722 | 1725 | /* |
@@ -3097,7 +3097,7 @@ | ||
3097 | 3097 | colnr_T col; |
3098 | 3098 | { |
3099 | 3099 | rmp->rmm_maxcol = syn_buf->b_p_smc; |
3100 | - if (vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col) > 0) | |
3100 | + if (vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, NULL) > 0) | |
3101 | 3101 | { |
3102 | 3102 | rmp->startpos[0].lnum += lnum; |
3103 | 3103 | rmp->endpos[0].lnum += lnum; |
@@ -3191,7 +3191,8 @@ | ||
3191 | 3191 | #endif |
3192 | 3192 | save_lnum = curwin->w_cursor.lnum; |
3193 | 3193 | curwin->w_cursor.lnum = 0; /* start search before first line */ |
3194 | - if (do_search(NULL, pbuf[0], pbuf + 1, (long)1, search_options)) | |
3194 | + if (do_search(NULL, pbuf[0], pbuf + 1, (long)1, | |
3195 | + search_options, NULL)) | |
3195 | 3196 | retval = OK; |
3196 | 3197 | else |
3197 | 3198 | { |
@@ -3203,7 +3204,7 @@ | ||
3203 | 3204 | */ |
3204 | 3205 | p_ic = TRUE; |
3205 | 3206 | if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1, |
3206 | - search_options)) | |
3207 | + search_options, NULL)) | |
3207 | 3208 | { |
3208 | 3209 | /* |
3209 | 3210 | * Failed to find pattern, take a guess: "^func (" |
@@ -3213,13 +3214,14 @@ | ||
3213 | 3214 | cc = *tagp.tagname_end; |
3214 | 3215 | *tagp.tagname_end = NUL; |
3215 | 3216 | sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname); |
3216 | - if (!do_search(NULL, '/', pbuf, (long)1, search_options)) | |
3217 | + if (!do_search(NULL, '/', pbuf, (long)1, | |
3218 | + search_options, NULL)) | |
3217 | 3219 | { |
3218 | 3220 | /* Guess again: "^char * \<func (" */ |
3219 | 3221 | sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(", |
3220 | 3222 | tagp.tagname); |
3221 | 3223 | if (!do_search(NULL, '/', pbuf, (long)1, |
3222 | - search_options)) | |
3224 | + search_options, NULL)) | |
3223 | 3225 | found = 0; |
3224 | 3226 | } |
3225 | 3227 | *tagp.tagname_end = cc; |
@@ -667,6 +667,8 @@ | ||
667 | 667 | static int included_patches[] = |
668 | 668 | { /* Add new patch number below this line */ |
669 | 669 | /**/ |
670 | + 236, | |
671 | +/**/ | |
670 | 672 | 235, |
671 | 673 | /**/ |
672 | 674 | 234, |
@@ -1550,6 +1550,16 @@ | ||
1550 | 1550 | # define MB_MAXBYTES 21 |
1551 | 1551 | #endif |
1552 | 1552 | |
1553 | +#if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO) | |
1554 | +# ifdef WIN3264 | |
1555 | +typedef LARGE_INTEGER proftime_T; | |
1556 | +# else | |
1557 | +typedef struct timeval proftime_T; | |
1558 | +# endif | |
1559 | +#else | |
1560 | +typedef int proftime_T; /* dummy for function prototypes */ | |
1561 | +#endif | |
1562 | + | |
1553 | 1563 | /* Include option.h before structs.h, because the number of window-local and |
1554 | 1564 | * buffer-local options is used there. */ |
1555 | 1565 | #include "option.h" /* options and default values */ |
@@ -1762,16 +1772,6 @@ | ||
1762 | 1772 | # define stat(a,b) (access(a,0) ? -1 : stat(a,b)) |
1763 | 1773 | #endif |
1764 | 1774 | |
1765 | -#if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO) | |
1766 | -# ifdef WIN3264 | |
1767 | -typedef LARGE_INTEGER proftime_T; | |
1768 | -# else | |
1769 | -typedef struct timeval proftime_T; | |
1770 | -# endif | |
1771 | -#else | |
1772 | -typedef int proftime_T; /* dummy for function prototypes */ | |
1773 | -#endif | |
1774 | - | |
1775 | 1775 | #include "ex_cmds.h" /* Ex command defines */ |
1776 | 1776 | #include "proto.h" /* function prototypes */ |
1777 | 1777 |