home *** CD-ROM | disk | FTP | other *** search
/ vim.ftp.fu-berlin.de / 2015-02-03.vim.ftp.fu-berlin.de.tar / vim.ftp.fu-berlin.de / patches / 7.1 / 7.1.236 < prev    next >
Encoding:
Internet Message Format  |  2008-01-18  |  28.3 KB

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