]> git.pld-linux.org Git - packages/vim.git/blob - 7.1.236
- new
[packages/vim.git] / 7.1.236
1 To: vim-dev@vim.org
2 Subject: Patch 7.1.236
3 Fcc: outbox
4 From: Bram Moolenaar <Bram@moolenaar.net>
5 Mime-Version: 1.0
6 Content-Type: text/plain; charset=ISO-8859-1
7 Content-Transfer-Encoding: 8bit
8 ------------
9
10 Patch 7.1.236
11 Problem:    When using 'incsearch' and 'hlsearch' a complicated pattern may
12             make Vim hang until CTRL-C is pressed.
13 Solution:   Add the 'redrawtime' option.
14 Files:      runtime/doc/options.txt, src/ex_cmds.c, src/ex_docmd.c,
15             src/ex_getln.c, src/gui.c, src/misc1.c, src/normal.c,
16             src/option.c, src/quickfix.c, src/regexp.c, src/proto/regexp.pro,
17             src/proto/search.pro, src/search.c, src/screen.c,
18             src/option.h, src/spell.c, src/structs.h, src/syntax.c, src/tag.c,
19             src/vim.h
20
21
22 *** ../vim-7.1.235/runtime/doc/options.txt      Sun Aug 12 16:55:01 2007
23 --- runtime/doc/options.txt     Sat Jan 19 14:01:22 2008
24 ***************
25 *** 3618,3623 ****
26 --- 3636,3642 ----
27         When you get bored looking at the highlighted matches, you can turn it
28         off with |:nohlsearch|.  As soon as you use a search command, the
29         highlighting comes back.
30 +       'redrawtime' specifies the maximum time spend on finding matches.
31         When the search pattern can match an end-of-line, Vim will try to
32         highlight all of the matched text.  However, this depends on where the
33         search starts.  This will be the first line in the window or the first
34 ***************
35 *** 3851,3856 ****
36 --- 3870,3879 ----
37         original position when no match is found and when pressing <Esc>.  You
38         still need to finish the search command with <Enter> to move the
39         cursor to the match.
40 +       When compiled with the |+reltime| feature Vim only searches for about
41 +       half a second.  With a complicated pattern and/or a lot of text the
42 +       match may not be found.  This is to avoid that Vim hangs while you
43 +       are typing the pattern.
44         The highlighting can be set with the 'i' flag in 'highlight'.
45         See also: 'hlsearch'.
46         CTRL-L can be used to add one character from after the current match
47 ***************
48 *** 5185,5190 ****
49 --- 5210,5227 ----
50         {not in Vi:}  When using the ":view" command the 'readonly' option is
51         set for the newly edited buffer.
52   
53 +                                               *'redrawtime'* *'rdt'*
54 + 'redrawtime' 'rdt'    number  (default 2000)
55 +                       global
56 +                       {not in Vi}
57 +                       {only available when compiled with the |+reltime|
58 +                       feature}
59 +       The time in milliseconds for redrawing the display.  This applies to
60 +       searching for patterns for 'hlsearch' and |:match| highlighting.
61 +       When redrawing takes more than this many milliseconds no further
62 +       matches will be highlighted.  This is used to avoid that Vim hangs
63 +       when using a very complicated pattern.
64
65                                                 *'remap'* *'noremap'*
66   'remap'                       boolean (default on)
67                         global
68 *** ../vim-7.1.235/src/ex_cmds.c        Sun Jan 13 13:30:34 2008
69 --- src/ex_cmds.c       Sat Jan 19 13:04:28 2008
70 ***************
71 *** 4446,4452 ****
72   #endif
73                 ); ++lnum)
74       {
75 !       nmatch = vim_regexec_multi(&regmatch, curwin, curbuf, lnum, (colnr_T)0);
76         if (nmatch)
77         {
78             colnr_T     copycol;
79 --- 4446,4453 ----
80   #endif
81                 ); ++lnum)
82       {
83 !       nmatch = vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
84 !                                                           (colnr_T)0, NULL);
85         if (nmatch)
86         {
87             colnr_T     copycol;
88 ***************
89 *** 4957,4963 ****
90                         || (do_ask && !re_lookbehind(regmatch.regprog))
91                         || nmatch_tl > 0
92                         || (nmatch = vim_regexec_multi(&regmatch, curwin,
93 !                                      curbuf, sub_firstlnum, matchcol)) == 0
94                         || regmatch.startpos[0].lnum > 0)
95                 {
96                     if (new_start != NULL)
97 --- 4958,4965 ----
98                         || (do_ask && !re_lookbehind(regmatch.regprog))
99                         || nmatch_tl > 0
100                         || (nmatch = vim_regexec_multi(&regmatch, curwin,
101 !                                                       curbuf, sub_firstlnum,
102 !                                                        matchcol, NULL)) == 0
103                         || regmatch.startpos[0].lnum > 0)
104                 {
105                     if (new_start != NULL)
106 ***************
107 *** 5022,5028 ****
108                     }
109                     if (nmatch == -1 && !lastone)
110                         nmatch = vim_regexec_multi(&regmatch, curwin, curbuf,
111 !                                                    sub_firstlnum, matchcol);
112   
113                     /*
114                      * 5. break if there isn't another match in this line
115 --- 5024,5030 ----
116                     }
117                     if (nmatch == -1 && !lastone)
118                         nmatch = vim_regexec_multi(&regmatch, curwin, curbuf,
119 !                                              sub_firstlnum, matchcol, NULL);
120   
121                     /*
122                      * 5. break if there isn't another match in this line
123 ***************
124 *** 5252,5258 ****
125       for (lnum = eap->line1; lnum <= eap->line2 && !got_int; ++lnum)
126       {
127         /* a match on this line? */
128 !       match = vim_regexec_multi(&regmatch, curwin, curbuf, lnum, (colnr_T)0);
129         if ((type == 'g' && match) || (type == 'v' && !match))
130         {
131             ml_setmarked(lnum);
132 --- 5254,5261 ----
133       for (lnum = eap->line1; lnum <= eap->line2 && !got_int; ++lnum)
134       {
135         /* a match on this line? */
136 !       match = vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
137 !                                                           (colnr_T)0, NULL);
138         if ((type == 'g' && match) || (type == 'v' && !match))
139         {
140             ml_setmarked(lnum);
141 *** ../vim-7.1.235/src/ex_docmd.c       Sun Jan 13 17:11:25 2008
142 --- src/ex_docmd.c      Fri Jan 18 21:01:16 2008
143 ***************
144 *** 3931,3937 ****
145                                 curwin->w_cursor.col = 0;
146                             searchcmdlen = 0;
147                             if (!do_search(NULL, c, cmd, 1L,
148 !                                     SEARCH_HIS + SEARCH_MSG + SEARCH_START))
149                             {
150                                 curwin->w_cursor = pos;
151                                 cmd = NULL;
152 --- 3931,3938 ----
153                                 curwin->w_cursor.col = 0;
154                             searchcmdlen = 0;
155                             if (!do_search(NULL, c, cmd, 1L,
156 !                                       SEARCH_HIS + SEARCH_MSG + SEARCH_START,
157 !                                       NULL))
158                             {
159                                 curwin->w_cursor = pos;
160                                 cmd = NULL;
161 *** ../vim-7.1.235/src/ex_getln.c       Fri Jan 18 13:15:32 2008
162 --- src/ex_getln.c      Fri Jan 18 21:34:42 2008
163 ***************
164 *** 1709,1714 ****
165 --- 1709,1717 ----
166         if (p_is && !cmd_silent && (firstc == '/' || firstc == '?'))
167         {
168             pos_T       end_pos;
169 + #ifdef FEAT_RELTIME
170 +           proftime_T  tm;
171 + #endif
172   
173             /* if there is a character waiting, search and redraw later */
174             if (char_avail())
175 ***************
176 *** 1727,1734 ****
177                 cursor_off();           /* so the user knows we're busy */
178                 out_flush();
179                 ++emsg_off;    /* So it doesn't beep if bad expr */
180                 i = do_search(NULL, firstc, ccline.cmdbuff, count,
181 !                       SEARCH_KEEP + SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK);
182                 --emsg_off;
183                 /* if interrupted while searching, behave like it failed */
184                 if (got_int)
185 --- 1730,1747 ----
186                 cursor_off();           /* so the user knows we're busy */
187                 out_flush();
188                 ++emsg_off;    /* So it doesn't beep if bad expr */
189 + #ifdef FEAT_RELTIME
190 +               /* Set the time limit to half a second. */
191 +               profile_setlimit(500L, &tm);
192 + #endif
193                 i = do_search(NULL, firstc, ccline.cmdbuff, count,
194 !                       SEARCH_KEEP + SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK,
195 ! #ifdef FEAT_RELTIME
196 !                       &tm
197 ! #else
198 !                       NULL
199 ! #endif
200 !                       );
201                 --emsg_off;
202                 /* if interrupted while searching, behave like it failed */
203                 if (got_int)
204 *** ../vim-7.1.235/src/gui.c    Thu Jan  3 16:14:25 2008
205 --- src/gui.c   Fri Jan 18 21:01:36 2008
206 ***************
207 *** 5052,5058 ****
208         /* Search for the next match. */
209         i = msg_scroll;
210         do_search(NULL, down ? '/' : '?', ga.ga_data, 1L,
211 !                                                   SEARCH_MSG + SEARCH_MARK);
212         msg_scroll = i;     /* don't let an error message set msg_scroll */
213       }
214   
215 --- 5052,5058 ----
216         /* Search for the next match. */
217         i = msg_scroll;
218         do_search(NULL, down ? '/' : '?', ga.ga_data, 1L,
219 !                                             SEARCH_MSG + SEARCH_MARK, NULL);
220         msg_scroll = i;     /* don't let an error message set msg_scroll */
221       }
222   
223 *** ../vim-7.1.235/src/misc1.c  Thu Jan  3 12:42:38 2008
224 --- src/misc1.c Sat Jan 19 13:04:39 2008
225 ***************
226 *** 437,443 ****
227       {
228         regmatch.rmm_ic = FALSE;
229         regmatch.rmm_maxcol = 0;
230 !       if (vim_regexec_multi(&regmatch, curwin, curbuf, lnum, (colnr_T)0))
231         {
232             pos.lnum = regmatch.endpos[0].lnum + lnum;
233             pos.col = regmatch.endpos[0].col;
234 --- 437,444 ----
235       {
236         regmatch.rmm_ic = FALSE;
237         regmatch.rmm_maxcol = 0;
238 !       if (vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
239 !                                                           (colnr_T)0, NULL))
240         {
241             pos.lnum = regmatch.endpos[0].lnum + lnum;
242             pos.col = regmatch.endpos[0].col;
243 *** ../vim-7.1.235/src/normal.c Sat Jan 12 17:11:25 2008
244 --- src/normal.c        Fri Jan 18 21:01:47 2008
245 ***************
246 *** 6093,6099 ****
247       curwin->w_set_curswant = TRUE;
248   
249       i = do_search(cap->oap, dir, pat, cap->count1,
250 !                                opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG);
251       if (i == 0)
252         clearop(cap->oap);
253       else
254 --- 6093,6099 ----
255       curwin->w_set_curswant = TRUE;
256   
257       i = do_search(cap->oap, dir, pat, cap->count1,
258 !                          opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, NULL);
259       if (i == 0)
260         clearop(cap->oap);
261       else
262 *** ../vim-7.1.235/src/option.c Tue Oct  2 20:40:01 2007
263 --- src/option.c        Sat Jan 19 13:44:33 2008
264 ***************
265 *** 1991,1996 ****
266 --- 1991,2003 ----
267       {"redraw",            NULL,   P_BOOL|P_VI_DEF,
268                             (char_u *)NULL, PV_NONE,
269                             {(char_u *)FALSE, (char_u *)0L}},
270 +     {"redrawtime",  "rdt",  P_NUM|P_VI_DEF,
271 + #ifdef FEAT_RELTIME
272 +                           (char_u *)&p_rdt, PV_NONE,
273 + #else
274 +                           (char_u *)NULL, PV_NONE,
275 + #endif
276 +                           {(char_u *)2000L, (char_u *)0L}},
277       {"remap",     NULL,   P_BOOL|P_VI_DEF,
278                             (char_u *)&p_remap, PV_NONE,
279                             {(char_u *)TRUE, (char_u *)0L}},
280 *** ../vim-7.1.235/src/quickfix.c       Sun Sep 30 14:00:41 2007
281 --- src/quickfix.c      Sat Jan 19 13:04:53 2008
282 ***************
283 *** 1803,1809 ****
284             /* Move the cursor to the first line in the buffer */
285             save_cursor = curwin->w_cursor;
286             curwin->w_cursor.lnum = 0;
287 !           if (!do_search(NULL, '/', qf_ptr->qf_pattern, (long)1, SEARCH_KEEP))
288                 curwin->w_cursor = save_cursor;
289         }
290   
291 --- 1803,1810 ----
292             /* Move the cursor to the first line in the buffer */
293             save_cursor = curwin->w_cursor;
294             curwin->w_cursor.lnum = 0;
295 !           if (!do_search(NULL, '/', qf_ptr->qf_pattern, (long)1,
296 !                                                          SEARCH_KEEP, NULL))
297                 curwin->w_cursor = save_cursor;
298         }
299   
300 ***************
301 *** 3159,3165 ****
302             {
303                 col = 0;
304                 while (vim_regexec_multi(&regmatch, curwin, buf, lnum,
305 !                                                                    col) > 0)
306                 {
307                     ;
308                     if (qf_add_entry(qi, &prevp,
309 --- 3160,3166 ----
310             {
311                 col = 0;
312                 while (vim_regexec_multi(&regmatch, curwin, buf, lnum,
313 !                                                              col, NULL) > 0)
314                 {
315                     ;
316                     if (qf_add_entry(qi, &prevp,
317 *** ../vim-7.1.235/src/regexp.c Fri Jan 18 20:36:40 2008
318 --- src/regexp.c        Sat Jan 19 15:18:12 2008
319 ***************
320 *** 3040,3046 ****
321   } save_se_T;
322   
323   static char_u *reg_getline __ARGS((linenr_T lnum));
324 ! static long   vim_regexec_both __ARGS((char_u *line, colnr_T col));
325   static long   regtry __ARGS((regprog_T *prog, colnr_T col));
326   static void   cleanup_subexpr __ARGS((void));
327   #ifdef FEAT_SYN_HL
328 --- 3040,3046 ----
329   } save_se_T;
330   
331   static char_u *reg_getline __ARGS((linenr_T lnum));
332 ! static long   vim_regexec_both __ARGS((char_u *line, colnr_T col, proftime_T *tm));
333   static long   regtry __ARGS((regprog_T *prog, colnr_T col));
334   static void   cleanup_subexpr __ARGS((void));
335   #ifdef FEAT_SYN_HL
336 ***************
337 *** 3284,3290 ****
338       ireg_icombine = FALSE;
339   #endif
340       ireg_maxcol = 0;
341 !     return (vim_regexec_both(line, col) != 0);
342   }
343   
344   #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
345 --- 3284,3290 ----
346       ireg_icombine = FALSE;
347   #endif
348       ireg_maxcol = 0;
349 !     return (vim_regexec_both(line, col, NULL) != 0);
350   }
351   
352   #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
353 ***************
354 *** 3308,3314 ****
355       ireg_icombine = FALSE;
356   #endif
357       ireg_maxcol = 0;
358 !     return (vim_regexec_both(line, col) != 0);
359   }
360   #endif
361   
362 --- 3308,3314 ----
363       ireg_icombine = FALSE;
364   #endif
365       ireg_maxcol = 0;
366 !     return (vim_regexec_both(line, col, NULL) != 0);
367   }
368   #endif
369   
370 ***************
371 *** 3321,3332 ****
372    * match otherwise.
373    */
374       long
375 ! vim_regexec_multi(rmp, win, buf, lnum, col)
376       regmmatch_T       *rmp;
377       win_T     *win;           /* window in which to search or NULL */
378       buf_T     *buf;           /* buffer in which to search */
379       linenr_T  lnum;           /* nr of line to start looking for match */
380       colnr_T   col;            /* column to start looking for match */
381   {
382       long      r;
383       buf_T     *save_curbuf = curbuf;
384 --- 3321,3333 ----
385    * match otherwise.
386    */
387       long
388 ! vim_regexec_multi(rmp, win, buf, lnum, col, tm)
389       regmmatch_T       *rmp;
390       win_T     *win;           /* window in which to search or NULL */
391       buf_T     *buf;           /* buffer in which to search */
392       linenr_T  lnum;           /* nr of line to start looking for match */
393       colnr_T   col;            /* column to start looking for match */
394 +     proftime_T        *tm;            /* timeout limit or NULL */
395   {
396       long      r;
397       buf_T     *save_curbuf = curbuf;
398 ***************
399 *** 3346,3352 ****
400   
401       /* Need to switch to buffer "buf" to make vim_iswordc() work. */
402       curbuf = buf;
403 !     r = vim_regexec_both(NULL, col);
404       curbuf = save_curbuf;
405   
406       return r;
407 --- 3347,3353 ----
408   
409       /* Need to switch to buffer "buf" to make vim_iswordc() work. */
410       curbuf = buf;
411 !     r = vim_regexec_both(NULL, col, tm);
412       curbuf = save_curbuf;
413   
414       return r;
415 ***************
416 *** 3356,3365 ****
417    * Match a regexp against a string ("line" points to the string) or multiple
418    * lines ("line" is NULL, use reg_getline()).
419    */
420       static long
421 ! vim_regexec_both(line, col)
422       char_u    *line;
423       colnr_T   col;            /* column to start looking for match */
424   {
425       regprog_T *prog;
426       char_u    *s;
427 --- 3357,3368 ----
428    * Match a regexp against a string ("line" points to the string) or multiple
429    * lines ("line" is NULL, use reg_getline()).
430    */
431 + /*ARGSUSED*/
432       static long
433 ! vim_regexec_both(line, col, tm)
434       char_u    *line;
435       colnr_T   col;            /* column to start looking for match */
436 +     proftime_T        *tm;            /* timeout limit or NULL */
437   {
438       regprog_T *prog;
439       char_u    *s;
440 ***************
441 *** 3502,3507 ****
442 --- 3505,3513 ----
443       }
444       else
445       {
446 + #ifdef FEAT_RELTIME
447 +       int tm_count = 0;
448 + #endif
449         /* Messy cases:  unanchored match. */
450         while (!got_int)
451         {
452 ***************
453 *** 3550,3555 ****
454 --- 3556,3570 ----
455             else
456   #endif
457                 ++col;
458 + #ifdef FEAT_RELTIME
459 +           /* Check for timeout once in a twenty times to avoid overhead. */
460 +           if (tm != NULL && ++tm_count == 20)
461 +           {
462 +               tm_count = 0;
463 +               if (profile_passed_limit(tm))
464 +                   break;
465 +           }
466 + #endif
467         }
468       }
469   
470 *** ../vim-7.1.235/src/proto/regexp.pro Sat May  5 19:42:08 2007
471 --- src/proto/regexp.pro        Sat Jan 19 13:14:09 2008
472 ***************
473 *** 1,13 ****
474   /* regexp.c */
475 - void free_regexp_stuff __ARGS((void));
476   int re_multiline __ARGS((regprog_T *prog));
477   int re_lookbehind __ARGS((regprog_T *prog));
478   char_u *skip_regexp __ARGS((char_u *startp, int dirc, int magic, char_u **newp));
479   regprog_T *vim_regcomp __ARGS((char_u *expr, int re_flags));
480   int vim_regcomp_had_eol __ARGS((void));
481   int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
482   int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
483 ! long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col));
484   reg_extmatch_T *ref_extmatch __ARGS((reg_extmatch_T *em));
485   void unref_extmatch __ARGS((reg_extmatch_T *em));
486   char_u *regtilde __ARGS((char_u *source, int magic));
487 --- 1,13 ----
488   /* regexp.c */
489   int re_multiline __ARGS((regprog_T *prog));
490   int re_lookbehind __ARGS((regprog_T *prog));
491   char_u *skip_regexp __ARGS((char_u *startp, int dirc, int magic, char_u **newp));
492   regprog_T *vim_regcomp __ARGS((char_u *expr, int re_flags));
493   int vim_regcomp_had_eol __ARGS((void));
494 + void free_regexp_stuff __ARGS((void));
495   int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
496   int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
497 ! long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
498   reg_extmatch_T *ref_extmatch __ARGS((reg_extmatch_T *em));
499   void unref_extmatch __ARGS((reg_extmatch_T *em));
500   char_u *regtilde __ARGS((char_u *source, int magic));
501 *** ../vim-7.1.235/src/proto/search.pro Sun Jan  6 20:05:36 2008
502 --- src/proto/search.pro        Fri Jan 18 21:03:49 2008
503 ***************
504 *** 11,17 ****
505   void set_last_search_pat __ARGS((char_u *s, int idx, int magic, int setlast));
506   void last_pat_prog __ARGS((regmmatch_T *regmatch));
507   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));
508 ! int do_search __ARGS((oparg_T *oap, int dirc, char_u *pat, long count, int options));
509   int search_for_exact_line __ARGS((buf_T *buf, pos_T *pos, int dir, char_u *pat));
510   int searchc __ARGS((cmdarg_T *cap, int t_cmd));
511   pos_T *findmatch __ARGS((oparg_T *oap, int initc));
512 --- 11,17 ----
513   void set_last_search_pat __ARGS((char_u *s, int idx, int magic, int setlast));
514   void last_pat_prog __ARGS((regmmatch_T *regmatch));
515   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));
516 ! int do_search __ARGS((oparg_T *oap, int dirc, char_u *pat, long count, int options, proftime_T *tm));
517   int search_for_exact_line __ARGS((buf_T *buf, pos_T *pos, int dir, char_u *pat));
518   int searchc __ARGS((cmdarg_T *cap, int t_cmd));
519   pos_T *findmatch __ARGS((oparg_T *oap, int initc));
520 *** ../vim-7.1.235/src/search.c Sun Jan  6 20:05:36 2008
521 --- src/search.c        Sat Jan 19 13:13:25 2008
522 ***************
523 *** 606,612 ****
524                  * Look for a match somewhere in line "lnum".
525                  */
526                 nmatched = vim_regexec_multi(&regmatch, win, buf,
527 !                                                           lnum, (colnr_T)0);
528                 /* Abort searching on an error (e.g., out of stack). */
529                 if (called_emsg)
530                     break;
531 --- 606,618 ----
532                  * Look for a match somewhere in line "lnum".
533                  */
534                 nmatched = vim_regexec_multi(&regmatch, win, buf,
535 !                                                     lnum, (colnr_T)0,
536 ! #ifdef FEAT_RELTIME
537 !                                                     tm
538 ! #else
539 !                                                     NULL
540 ! #endif
541 !                                                     );
542                 /* Abort searching on an error (e.g., out of stack). */
543                 if (called_emsg)
544                     break;
545 ***************
546 *** 615,623 ****
547                     /* match may actually be in another line when using \zs */
548                     matchpos = regmatch.startpos[0];
549                     endpos = regmatch.endpos[0];
550 ! # ifdef FEAT_EVAL
551                     submatch = first_submatch(&regmatch);
552 ! # endif
553                     /* Line me be past end of buffer for "\n\zs". */
554                     if (lnum + matchpos.lnum > buf->b_ml.ml_line_count)
555                         ptr = (char_u *)"";
556 --- 621,629 ----
557                     /* match may actually be in another line when using \zs */
558                     matchpos = regmatch.startpos[0];
559                     endpos = regmatch.endpos[0];
560 ! #ifdef FEAT_EVAL
561                     submatch = first_submatch(&regmatch);
562 ! #endif
563                     /* Line me be past end of buffer for "\n\zs". */
564                     if (lnum + matchpos.lnum > buf->b_ml.ml_line_count)
565                         ptr = (char_u *)"";
566 ***************
567 *** 693,699 ****
568                             if (ptr[matchcol] == NUL
569                                     || (nmatched = vim_regexec_multi(&regmatch,
570                                               win, buf, lnum + matchpos.lnum,
571 !                                             matchcol)) == 0)
572                             {
573                                 match_ok = FALSE;
574                                 break;
575 --- 699,711 ----
576                             if (ptr[matchcol] == NUL
577                                     || (nmatched = vim_regexec_multi(&regmatch,
578                                               win, buf, lnum + matchpos.lnum,
579 !                                             matchcol,
580 ! #ifdef FEAT_RELTIME
581 !                                             tm
582 ! #else
583 !                                             NULL
584 ! #endif
585 !                                             )) == 0)
586                             {
587                                 match_ok = FALSE;
588                                 break;
589 ***************
590 *** 799,805 ****
591                             if (ptr[matchcol] == NUL
592                                     || (nmatched = vim_regexec_multi(&regmatch,
593                                               win, buf, lnum + matchpos.lnum,
594 !                                                             matchcol)) == 0)
595                                 break;
596   
597                             /* Need to get the line pointer again, a
598 --- 811,823 ----
599                             if (ptr[matchcol] == NUL
600                                     || (nmatched = vim_regexec_multi(&regmatch,
601                                               win, buf, lnum + matchpos.lnum,
602 !                                             matchcol,
603 ! #ifdef FEAT_RELTIME
604 !                                             tm
605 ! #else
606 !                                             NULL
607 ! #endif
608 !                                           )) == 0)
609                                 break;
610   
611                             /* Need to get the line pointer again, a
612 ***************
613 *** 977,988 ****
614    * return 0 for failure, 1 for found, 2 for found and line offset added
615    */
616       int
617 ! do_search(oap, dirc, pat, count, options)
618       oparg_T       *oap;       /* can be NULL */
619       int                   dirc;       /* '/' or '?' */
620       char_u       *pat;
621       long          count;
622       int                   options;
623   {
624       pos_T         pos;        /* position of the last match */
625       char_u        *searchstr;
626 --- 995,1007 ----
627    * return 0 for failure, 1 for found, 2 for found and line offset added
628    */
629       int
630 ! do_search(oap, dirc, pat, count, options, tm)
631       oparg_T       *oap;       /* can be NULL */
632       int                   dirc;       /* '/' or '?' */
633       char_u       *pat;
634       long          count;
635       int                   options;
636 +     proftime_T            *tm;        /* timeout limit or NULL */
637   {
638       pos_T         pos;        /* position of the last match */
639       char_u        *searchstr;
640 ***************
641 *** 1256,1262 ****
642                        (SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS
643                         + SEARCH_MSG + SEARCH_START
644                         + ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))),
645 !               RE_LAST, (linenr_T)0, NULL);
646   
647         if (dircp != NULL)
648             *dircp = dirc;      /* restore second '/' or '?' for normal_cmd() */
649 --- 1275,1281 ----
650                        (SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS
651                         + SEARCH_MSG + SEARCH_START
652                         + ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))),
653 !               RE_LAST, (linenr_T)0, tm);
654   
655         if (dircp != NULL)
656             *dircp = dirc;      /* restore second '/' or '?' for normal_cmd() */
657 *** ../vim-7.1.235/src/screen.c Sat Jan 12 16:45:25 2008
658 --- src/screen.c        Sat Jan 19 13:52:29 2008
659 ***************
660 *** 848,858 ****
661 --- 848,863 ----
662         cur->hl.buf = buf;
663         cur->hl.lnum = 0;
664         cur->hl.first_lnum = 0;
665 + # ifdef FEAT_RELTIME
666 +       /* Set the time limit to 'redrawtime'. */
667 +       profile_setlimit(p_rdt, &(cur->hl.tm));
668 + # endif
669         cur = cur->next;
670       }
671       search_hl.buf = buf;
672       search_hl.lnum = 0;
673       search_hl.first_lnum = 0;
674 +     /* time limit is set at the toplevel, for all windows */
675   #endif
676   
677   #ifdef FEAT_LINEBREAK
678 ***************
679 *** 6462,6467 ****
680 --- 6467,6476 ----
681       {
682         last_pat_prog(&search_hl.rm);
683         search_hl.attr = hl_attr(HLF_L);
684 + # ifdef FEAT_RELTIME
685 +       /* Set the time limit to 'redrawtime'. */
686 +       profile_setlimit(p_rdt, &search_hl.tm);
687 + # endif
688       }
689   }
690   
691 ***************
692 *** 6587,6592 ****
693 --- 6596,6609 ----
694       called_emsg = FALSE;
695       for (;;)
696       {
697 + #ifdef FEAT_RELTIME
698 +       /* Stop searching after passing the time limit. */
699 +       if (profile_passed_limit(&(shl->tm)))
700 +       {
701 +           shl->lnum = 0;              /* no match found in time */
702 +           break;
703 +       }
704 + #endif
705         /* Three situations:
706          * 1. No useful previous match: search from start of line.
707          * 2. Not Vi compatible or empty match: continue at next character.
708 ***************
709 *** 6620,6626 ****
710             matchcol = shl->rm.endpos[0].col;
711   
712         shl->lnum = lnum;
713 !       nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol);
714         if (called_emsg)
715         {
716             /* Error while handling regexp: stop using this regexp. */
717 --- 6637,6649 ----
718             matchcol = shl->rm.endpos[0].col;
719   
720         shl->lnum = lnum;
721 !       nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol,
722 ! #ifdef FEAT_RELTIME
723 !               &(shl->tm)
724 ! #else
725 !               NULL
726 ! #endif
727 !               );
728         if (called_emsg)
729         {
730             /* Error while handling regexp: stop using this regexp. */
731 *** ../vim-7.1.235/src/option.h Thu May 10 20:34:47 2007
732 --- src/option.h        Sat Jan 19 13:45:51 2008
733 ***************
734 *** 633,638 ****
735 --- 633,641 ----
736   #ifdef FEAT_SEARCHPATH
737   EXTERN char_u *p_cdpath;      /* 'cdpath' */
738   #endif
739 + #ifdef FEAT_RELTIME
740 + EXTERN long   p_rdt;          /* 'redrawtime' */
741 + #endif
742   EXTERN int    p_remap;        /* 'remap' */
743   EXTERN long   p_report;       /* 'report' */
744   #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
745 *** ../vim-7.1.235/src/spell.c  Sat Jan 12 16:45:25 2008
746 --- src/spell.c Fri Jan 18 21:02:47 2008
747 ***************
748 *** 10343,10349 ****
749       curwin->w_cursor.lnum = 0;
750       while (!got_int)
751       {
752 !       if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP) == 0
753                                                    || u_save_cursor() == FAIL)
754             break;
755   
756 --- 10343,10349 ----
757       curwin->w_cursor.lnum = 0;
758       while (!got_int)
759       {
760 !       if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP, NULL) == 0
761                                                    || u_save_cursor() == FAIL)
762             break;
763   
764 *** ../vim-7.1.235/src/structs.h        Mon Oct  1 22:53:27 2007
765 --- src/structs.h       Fri Jan 18 21:18:53 2008
766 ***************
767 *** 1717,1722 ****
768 --- 1717,1725 ----
769       linenr_T  first_lnum;     /* first lnum to search for multi-line pat */
770       colnr_T   startcol; /* in win_line() points to char where HL starts */
771       colnr_T   endcol;  /* in win_line() points to char where HL ends */
772 + #ifdef FEAT_RELTIME
773 +     proftime_T        tm;     /* for a time limit */
774 + #endif
775   } match_T;
776   
777   /*
778 *** ../vim-7.1.235/src/syntax.c Sun Jan 13 17:39:29 2008
779 --- src/syntax.c        Sat Jan 19 13:13:49 2008
780 ***************
781 *** 3097,3103 ****
782       colnr_T   col;
783   {
784       rmp->rmm_maxcol = syn_buf->b_p_smc;
785 !     if (vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col) > 0)
786       {
787         rmp->startpos[0].lnum += lnum;
788         rmp->endpos[0].lnum += lnum;
789 --- 3097,3103 ----
790       colnr_T   col;
791   {
792       rmp->rmm_maxcol = syn_buf->b_p_smc;
793 !     if (vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, NULL) > 0)
794       {
795         rmp->startpos[0].lnum += lnum;
796         rmp->endpos[0].lnum += lnum;
797 *** ../vim-7.1.235/src/tag.c    Thu May 10 19:44:07 2007
798 --- src/tag.c   Fri Jan 18 21:03:41 2008
799 ***************
800 *** 3191,3197 ****
801   #endif
802             save_lnum = curwin->w_cursor.lnum;
803             curwin->w_cursor.lnum = 0;  /* start search before first line */
804 !           if (do_search(NULL, pbuf[0], pbuf + 1, (long)1, search_options))
805                 retval = OK;
806             else
807             {
808 --- 3191,3198 ----
809   #endif
810             save_lnum = curwin->w_cursor.lnum;
811             curwin->w_cursor.lnum = 0;  /* start search before first line */
812 !           if (do_search(NULL, pbuf[0], pbuf + 1, (long)1,
813 !                                                       search_options, NULL))
814                 retval = OK;
815             else
816             {
817 ***************
818 *** 3203,3209 ****
819                  */
820                 p_ic = TRUE;
821                 if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1,
822 !                                                             search_options))
823                 {
824                     /*
825                      * Failed to find pattern, take a guess: "^func  ("
826 --- 3204,3210 ----
827                  */
828                 p_ic = TRUE;
829                 if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1,
830 !                                                       search_options, NULL))
831                 {
832                     /*
833                      * Failed to find pattern, take a guess: "^func  ("
834 ***************
835 *** 3213,3225 ****
836                     cc = *tagp.tagname_end;
837                     *tagp.tagname_end = NUL;
838                     sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname);
839 !                   if (!do_search(NULL, '/', pbuf, (long)1, search_options))
840                     {
841                         /* Guess again: "^char * \<func  (" */
842                         sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
843                                                                 tagp.tagname);
844                         if (!do_search(NULL, '/', pbuf, (long)1,
845 !                                                             search_options))
846                             found = 0;
847                     }
848                     *tagp.tagname_end = cc;
849 --- 3214,3227 ----
850                     cc = *tagp.tagname_end;
851                     *tagp.tagname_end = NUL;
852                     sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname);
853 !                   if (!do_search(NULL, '/', pbuf, (long)1,
854 !                                                       search_options, NULL))
855                     {
856                         /* Guess again: "^char * \<func  (" */
857                         sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
858                                                                 tagp.tagname);
859                         if (!do_search(NULL, '/', pbuf, (long)1,
860 !                                                       search_options, NULL))
861                             found = 0;
862                     }
863                     *tagp.tagname_end = cc;
864 *** ../vim-7.1.235/src/vim.h    Sat Jan  5 13:34:01 2008
865 --- src/vim.h   Fri Jan 18 21:29:22 2008
866 ***************
867 *** 1550,1555 ****
868 --- 1550,1565 ----
869   # define MB_MAXBYTES  21
870   #endif
871   
872 + #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO)
873 + # ifdef WIN3264
874 + typedef LARGE_INTEGER proftime_T;
875 + # else
876 + typedef struct timeval proftime_T;
877 + # endif
878 + #else
879 + typedef int proftime_T;           /* dummy for function prototypes */
880 + #endif
881
882   /* Include option.h before structs.h, because the number of window-local and
883    * buffer-local options is used there. */
884   #include "option.h"       /* options and default values */
885 ***************
886 *** 1760,1775 ****
887   # include <io.h>          /* for access() */
888   
889   # define stat(a,b) (access(a,0) ? -1 : stat(a,b))
890 - #endif
891
892 - #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO)
893 - # ifdef WIN3264
894 - typedef LARGE_INTEGER proftime_T;
895 - # else
896 - typedef struct timeval proftime_T;
897 - # endif
898 - #else
899 - typedef int proftime_T;           /* dummy for function prototypes */
900   #endif
901   
902   #include "ex_cmds.h"      /* Ex command defines */
903 --- 1770,1775 ----
904 *** ../vim-7.1.235/src/version.c        Fri Jan 18 20:36:40 2008
905 --- src/version.c       Sat Jan 19 15:19:48 2008
906 ***************
907 *** 668,669 ****
908 --- 668,671 ----
909   {   /* Add new patch number below this line */
910 + /**/
911 +     236,
912   /**/
913
914 -- 
915 Every time I lose weight, it finds me again!
916
917  /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
918 ///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
919 \\\        download, build and distribute -- http://www.A-A-P.org        ///
920  \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///
This page took 0.118555 seconds and 3 git commands to generate.