Karsten Hopp 9c3490
To: vim-dev@vim.org
Karsten Hopp 9c3490
Subject: Patch 7.1.236
Karsten Hopp 9c3490
Fcc: outbox
Karsten Hopp 9c3490
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 9c3490
Mime-Version: 1.0
Karsten Hopp 9c3490
Content-Type: text/plain; charset=ISO-8859-1
Karsten Hopp 9c3490
Content-Transfer-Encoding: 8bit
Karsten Hopp 9c3490
------------
Karsten Hopp 9c3490
Karsten Hopp 9c3490
Patch 7.1.236
Karsten Hopp 9c3490
Problem:    When using 'incsearch' and 'hlsearch' a complicated pattern may
Karsten Hopp 9c3490
	    make Vim hang until CTRL-C is pressed.
Karsten Hopp 9c3490
Solution:   Add the 'redrawtime' option.
Karsten Hopp 9c3490
Files:	    runtime/doc/options.txt, src/ex_cmds.c, src/ex_docmd.c,
Karsten Hopp 9c3490
	    src/ex_getln.c, src/gui.c, src/misc1.c, src/normal.c,
Karsten Hopp 9c3490
	    src/option.c, src/quickfix.c, src/regexp.c, src/proto/regexp.pro,
Karsten Hopp 9c3490
	    src/proto/search.pro, src/search.c, src/screen.c,
Karsten Hopp 9c3490
	    src/option.h, src/spell.c, src/structs.h, src/syntax.c, src/tag.c,
Karsten Hopp 9c3490
	    src/vim.h
Karsten Hopp 9c3490
Karsten Hopp 9c3490
Karsten Hopp 9c3490
*** ../vim-7.1.235/runtime/doc/options.txt	Sun Aug 12 16:55:01 2007
Karsten Hopp 9c3490
--- runtime/doc/options.txt	Sat Jan 19 14:01:22 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3618,3623 ****
Karsten Hopp 9c3490
--- 3636,3642 ----
Karsten Hopp 9c3490
  	When you get bored looking at the highlighted matches, you can turn it
Karsten Hopp 9c3490
  	off with |:nohlsearch|.  As soon as you use a search command, the
Karsten Hopp 9c3490
  	highlighting comes back.
Karsten Hopp 9c3490
+ 	'redrawtime' specifies the maximum time spend on finding matches.
Karsten Hopp 9c3490
  	When the search pattern can match an end-of-line, Vim will try to
Karsten Hopp 9c3490
  	highlight all of the matched text.  However, this depends on where the
Karsten Hopp 9c3490
  	search starts.  This will be the first line in the window or the first
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3851,3856 ****
Karsten Hopp 9c3490
--- 3870,3879 ----
Karsten Hopp 9c3490
  	original position when no match is found and when pressing <Esc>.  You
Karsten Hopp 9c3490
  	still need to finish the search command with <Enter> to move the
Karsten Hopp 9c3490
  	cursor to the match.
Karsten Hopp 9c3490
+ 	When compiled with the |+reltime| feature Vim only searches for about
Karsten Hopp 9c3490
+ 	half a second.  With a complicated pattern and/or a lot of text the
Karsten Hopp 9c3490
+ 	match may not be found.  This is to avoid that Vim hangs while you
Karsten Hopp 9c3490
+ 	are typing the pattern.
Karsten Hopp 9c3490
  	The highlighting can be set with the 'i' flag in 'highlight'.
Karsten Hopp 9c3490
  	See also: 'hlsearch'.
Karsten Hopp 9c3490
  	CTRL-L can be used to add one character from after the current match
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 5185,5190 ****
Karsten Hopp 9c3490
--- 5210,5227 ----
Karsten Hopp 9c3490
  	{not in Vi:}  When using the ":view" command the 'readonly' option is
Karsten Hopp 9c3490
  	set for the newly edited buffer.
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
+ 						*'redrawtime'* *'rdt'*
Karsten Hopp 9c3490
+ 'redrawtime' 'rdt'	number	(default 2000)
Karsten Hopp 9c3490
+ 			global
Karsten Hopp 9c3490
+ 			{not in Vi}
Karsten Hopp 9c3490
+ 			{only available when compiled with the |+reltime|
Karsten Hopp 9c3490
+ 			feature}
Karsten Hopp 9c3490
+ 	The time in milliseconds for redrawing the display.  This applies to
Karsten Hopp 9c3490
+ 	searching for patterns for 'hlsearch' and |:match| highlighting.
Karsten Hopp 9c3490
+ 	When redrawing takes more than this many milliseconds no further
Karsten Hopp 9c3490
+ 	matches will be highlighted.  This is used to avoid that Vim hangs
Karsten Hopp 9c3490
+ 	when using a very complicated pattern.
Karsten Hopp 9c3490
+ 
Karsten Hopp 9c3490
  						*'remap'* *'noremap'*
Karsten Hopp 9c3490
  'remap'			boolean	(default on)
Karsten Hopp 9c3490
  			global
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/ex_cmds.c	Sun Jan 13 13:30:34 2008
Karsten Hopp 9c3490
--- src/ex_cmds.c	Sat Jan 19 13:04:28 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 4446,4452 ****
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  		); ++lnum)
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
! 	nmatch = vim_regexec_multi(&regmatch, curwin, curbuf, lnum, (colnr_T)0);
Karsten Hopp 9c3490
  	if (nmatch)
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
  	    colnr_T	copycol;
Karsten Hopp 9c3490
--- 4446,4453 ----
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  		); ++lnum)
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
! 	nmatch = vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
Karsten Hopp 9c3490
! 							    (colnr_T)0, NULL);
Karsten Hopp 9c3490
  	if (nmatch)
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
  	    colnr_T	copycol;
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 4957,4963 ****
Karsten Hopp 9c3490
  			|| (do_ask && !re_lookbehind(regmatch.regprog))
Karsten Hopp 9c3490
  			|| nmatch_tl > 0
Karsten Hopp 9c3490
  			|| (nmatch = vim_regexec_multi(&regmatch, curwin,
Karsten Hopp 9c3490
! 				       curbuf, sub_firstlnum, matchcol)) == 0
Karsten Hopp 9c3490
  			|| regmatch.startpos[0].lnum > 0)
Karsten Hopp 9c3490
  		{
Karsten Hopp 9c3490
  		    if (new_start != NULL)
Karsten Hopp 9c3490
--- 4958,4965 ----
Karsten Hopp 9c3490
  			|| (do_ask && !re_lookbehind(regmatch.regprog))
Karsten Hopp 9c3490
  			|| nmatch_tl > 0
Karsten Hopp 9c3490
  			|| (nmatch = vim_regexec_multi(&regmatch, curwin,
Karsten Hopp 9c3490
! 							curbuf, sub_firstlnum,
Karsten Hopp 9c3490
! 							 matchcol, NULL)) == 0
Karsten Hopp 9c3490
  			|| regmatch.startpos[0].lnum > 0)
Karsten Hopp 9c3490
  		{
Karsten Hopp 9c3490
  		    if (new_start != NULL)
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 5022,5028 ****
Karsten Hopp 9c3490
  		    }
Karsten Hopp 9c3490
  		    if (nmatch == -1 && !lastone)
Karsten Hopp 9c3490
  			nmatch = vim_regexec_multi(&regmatch, curwin, curbuf,
Karsten Hopp 9c3490
! 						     sub_firstlnum, matchcol);
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  		    /*
Karsten Hopp 9c3490
  		     * 5. break if there isn't another match in this line
Karsten Hopp 9c3490
--- 5024,5030 ----
Karsten Hopp 9c3490
  		    }
Karsten Hopp 9c3490
  		    if (nmatch == -1 && !lastone)
Karsten Hopp 9c3490
  			nmatch = vim_regexec_multi(&regmatch, curwin, curbuf,
Karsten Hopp 9c3490
! 					       sub_firstlnum, matchcol, NULL);
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  		    /*
Karsten Hopp 9c3490
  		     * 5. break if there isn't another match in this line
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 5252,5258 ****
Karsten Hopp 9c3490
      for (lnum = eap->line1; lnum <= eap->line2 && !got_int; ++lnum)
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
  	/* a match on this line? */
Karsten Hopp 9c3490
! 	match = vim_regexec_multi(&regmatch, curwin, curbuf, lnum, (colnr_T)0);
Karsten Hopp 9c3490
  	if ((type == 'g' && match) || (type == 'v' && !match))
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
  	    ml_setmarked(lnum);
Karsten Hopp 9c3490
--- 5254,5261 ----
Karsten Hopp 9c3490
      for (lnum = eap->line1; lnum <= eap->line2 && !got_int; ++lnum)
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
  	/* a match on this line? */
Karsten Hopp 9c3490
! 	match = vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
Karsten Hopp 9c3490
! 							    (colnr_T)0, NULL);
Karsten Hopp 9c3490
  	if ((type == 'g' && match) || (type == 'v' && !match))
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
  	    ml_setmarked(lnum);
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/ex_docmd.c	Sun Jan 13 17:11:25 2008
Karsten Hopp 9c3490
--- src/ex_docmd.c	Fri Jan 18 21:01:16 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3931,3937 ****
Karsten Hopp 9c3490
  				curwin->w_cursor.col = 0;
Karsten Hopp 9c3490
  			    searchcmdlen = 0;
Karsten Hopp 9c3490
  			    if (!do_search(NULL, c, cmd, 1L,
Karsten Hopp 9c3490
! 				      SEARCH_HIS + SEARCH_MSG + SEARCH_START))
Karsten Hopp 9c3490
  			    {
Karsten Hopp 9c3490
  				curwin->w_cursor = pos;
Karsten Hopp 9c3490
  				cmd = NULL;
Karsten Hopp 9c3490
--- 3931,3938 ----
Karsten Hopp 9c3490
  				curwin->w_cursor.col = 0;
Karsten Hopp 9c3490
  			    searchcmdlen = 0;
Karsten Hopp 9c3490
  			    if (!do_search(NULL, c, cmd, 1L,
Karsten Hopp 9c3490
! 					SEARCH_HIS + SEARCH_MSG + SEARCH_START,
Karsten Hopp 9c3490
! 					NULL))
Karsten Hopp 9c3490
  			    {
Karsten Hopp 9c3490
  				curwin->w_cursor = pos;
Karsten Hopp 9c3490
  				cmd = NULL;
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/ex_getln.c	Fri Jan 18 13:15:32 2008
Karsten Hopp 9c3490
--- src/ex_getln.c	Fri Jan 18 21:34:42 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 1709,1714 ****
Karsten Hopp 9c3490
--- 1709,1717 ----
Karsten Hopp 9c3490
  	if (p_is && !cmd_silent && (firstc == '/' || firstc == '?'))
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
  	    pos_T	end_pos;
Karsten Hopp 9c3490
+ #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+ 	    proftime_T	tm;
Karsten Hopp 9c3490
+ #endif
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  	    /* if there is a character waiting, search and redraw later */
Karsten Hopp 9c3490
  	    if (char_avail())
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 1727,1734 ****
Karsten Hopp 9c3490
  		cursor_off();		/* so the user knows we're busy */
Karsten Hopp 9c3490
  		out_flush();
Karsten Hopp 9c3490
  		++emsg_off;    /* So it doesn't beep if bad expr */
Karsten Hopp 9c3490
  		i = do_search(NULL, firstc, ccline.cmdbuff, count,
Karsten Hopp 9c3490
! 			SEARCH_KEEP + SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK);
Karsten Hopp 9c3490
  		--emsg_off;
Karsten Hopp 9c3490
  		/* if interrupted while searching, behave like it failed */
Karsten Hopp 9c3490
  		if (got_int)
Karsten Hopp 9c3490
--- 1730,1747 ----
Karsten Hopp 9c3490
  		cursor_off();		/* so the user knows we're busy */
Karsten Hopp 9c3490
  		out_flush();
Karsten Hopp 9c3490
  		++emsg_off;    /* So it doesn't beep if bad expr */
Karsten Hopp 9c3490
+ #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+ 		/* Set the time limit to half a second. */
Karsten Hopp 9c3490
+ 		profile_setlimit(500L, &tm;;
Karsten Hopp 9c3490
+ #endif
Karsten Hopp 9c3490
  		i = do_search(NULL, firstc, ccline.cmdbuff, count,
Karsten Hopp 9c3490
! 			SEARCH_KEEP + SEARCH_OPT + SEARCH_NOOF + SEARCH_PEEK,
Karsten Hopp 9c3490
! #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
! 			&tm
Karsten Hopp 9c3490
! #else
Karsten Hopp 9c3490
! 			NULL
Karsten Hopp 9c3490
! #endif
Karsten Hopp 9c3490
! 			);
Karsten Hopp 9c3490
  		--emsg_off;
Karsten Hopp 9c3490
  		/* if interrupted while searching, behave like it failed */
Karsten Hopp 9c3490
  		if (got_int)
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/gui.c	Thu Jan  3 16:14:25 2008
Karsten Hopp 9c3490
--- src/gui.c	Fri Jan 18 21:01:36 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 5052,5058 ****
Karsten Hopp 9c3490
  	/* Search for the next match. */
Karsten Hopp 9c3490
  	i = msg_scroll;
Karsten Hopp 9c3490
  	do_search(NULL, down ? '/' : '?', ga.ga_data, 1L,
Karsten Hopp 9c3490
! 						    SEARCH_MSG + SEARCH_MARK);
Karsten Hopp 9c3490
  	msg_scroll = i;	    /* don't let an error message set msg_scroll */
Karsten Hopp 9c3490
      }
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
--- 5052,5058 ----
Karsten Hopp 9c3490
  	/* Search for the next match. */
Karsten Hopp 9c3490
  	i = msg_scroll;
Karsten Hopp 9c3490
  	do_search(NULL, down ? '/' : '?', ga.ga_data, 1L,
Karsten Hopp 9c3490
! 					      SEARCH_MSG + SEARCH_MARK, NULL);
Karsten Hopp 9c3490
  	msg_scroll = i;	    /* don't let an error message set msg_scroll */
Karsten Hopp 9c3490
      }
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/misc1.c	Thu Jan  3 12:42:38 2008
Karsten Hopp 9c3490
--- src/misc1.c	Sat Jan 19 13:04:39 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 437,443 ****
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
  	regmatch.rmm_ic = FALSE;
Karsten Hopp 9c3490
  	regmatch.rmm_maxcol = 0;
Karsten Hopp 9c3490
! 	if (vim_regexec_multi(&regmatch, curwin, curbuf, lnum, (colnr_T)0))
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
  	    pos.lnum = regmatch.endpos[0].lnum + lnum;
Karsten Hopp 9c3490
  	    pos.col = regmatch.endpos[0].col;
Karsten Hopp 9c3490
--- 437,444 ----
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
  	regmatch.rmm_ic = FALSE;
Karsten Hopp 9c3490
  	regmatch.rmm_maxcol = 0;
Karsten Hopp 9c3490
! 	if (vim_regexec_multi(&regmatch, curwin, curbuf, lnum,
Karsten Hopp 9c3490
! 							    (colnr_T)0, NULL))
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
  	    pos.lnum = regmatch.endpos[0].lnum + lnum;
Karsten Hopp 9c3490
  	    pos.col = regmatch.endpos[0].col;
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/normal.c	Sat Jan 12 17:11:25 2008
Karsten Hopp 9c3490
--- src/normal.c	Fri Jan 18 21:01:47 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 6093,6099 ****
Karsten Hopp 9c3490
      curwin->w_set_curswant = TRUE;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
      i = do_search(cap->oap, dir, pat, cap->count1,
Karsten Hopp 9c3490
! 				 opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG);
Karsten Hopp 9c3490
      if (i == 0)
Karsten Hopp 9c3490
  	clearop(cap->oap);
Karsten Hopp 9c3490
      else
Karsten Hopp 9c3490
--- 6093,6099 ----
Karsten Hopp 9c3490
      curwin->w_set_curswant = TRUE;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
      i = do_search(cap->oap, dir, pat, cap->count1,
Karsten Hopp 9c3490
! 			   opt | SEARCH_OPT | SEARCH_ECHO | SEARCH_MSG, NULL);
Karsten Hopp 9c3490
      if (i == 0)
Karsten Hopp 9c3490
  	clearop(cap->oap);
Karsten Hopp 9c3490
      else
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/option.c	Tue Oct  2 20:40:01 2007
Karsten Hopp 9c3490
--- src/option.c	Sat Jan 19 13:44:33 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 1991,1996 ****
Karsten Hopp 9c3490
--- 1991,2003 ----
Karsten Hopp 9c3490
      {"redraw",	    NULL,   P_BOOL|P_VI_DEF,
Karsten Hopp 9c3490
  			    (char_u *)NULL, PV_NONE,
Karsten Hopp 9c3490
  			    {(char_u *)FALSE, (char_u *)0L}},
Karsten Hopp 9c3490
+     {"redrawtime",  "rdt",  P_NUM|P_VI_DEF,
Karsten Hopp 9c3490
+ #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+ 			    (char_u *)&p_rdt, PV_NONE,
Karsten Hopp 9c3490
+ #else
Karsten Hopp 9c3490
+ 			    (char_u *)NULL, PV_NONE,
Karsten Hopp 9c3490
+ #endif
Karsten Hopp 9c3490
+ 			    {(char_u *)2000L, (char_u *)0L}},
Karsten Hopp 9c3490
      {"remap",	    NULL,   P_BOOL|P_VI_DEF,
Karsten Hopp 9c3490
  			    (char_u *)&p_remap, PV_NONE,
Karsten Hopp 9c3490
  			    {(char_u *)TRUE, (char_u *)0L}},
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/quickfix.c	Sun Sep 30 14:00:41 2007
Karsten Hopp 9c3490
--- src/quickfix.c	Sat Jan 19 13:04:53 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 1803,1809 ****
Karsten Hopp 9c3490
  	    /* Move the cursor to the first line in the buffer */
Karsten Hopp 9c3490
  	    save_cursor = curwin->w_cursor;
Karsten Hopp 9c3490
  	    curwin->w_cursor.lnum = 0;
Karsten Hopp 9c3490
! 	    if (!do_search(NULL, '/', qf_ptr->qf_pattern, (long)1, SEARCH_KEEP))
Karsten Hopp 9c3490
  		curwin->w_cursor = save_cursor;
Karsten Hopp 9c3490
  	}
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
--- 1803,1810 ----
Karsten Hopp 9c3490
  	    /* Move the cursor to the first line in the buffer */
Karsten Hopp 9c3490
  	    save_cursor = curwin->w_cursor;
Karsten Hopp 9c3490
  	    curwin->w_cursor.lnum = 0;
Karsten Hopp 9c3490
! 	    if (!do_search(NULL, '/', qf_ptr->qf_pattern, (long)1,
Karsten Hopp 9c3490
! 							   SEARCH_KEEP, NULL))
Karsten Hopp 9c3490
  		curwin->w_cursor = save_cursor;
Karsten Hopp 9c3490
  	}
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3159,3165 ****
Karsten Hopp 9c3490
  	    {
Karsten Hopp 9c3490
  		col = 0;
Karsten Hopp 9c3490
  		while (vim_regexec_multi(&regmatch, curwin, buf, lnum,
Karsten Hopp 9c3490
! 								     col) > 0)
Karsten Hopp 9c3490
  		{
Karsten Hopp 9c3490
  		    ;
Karsten Hopp 9c3490
  		    if (qf_add_entry(qi, &prevp,
Karsten Hopp 9c3490
--- 3160,3166 ----
Karsten Hopp 9c3490
  	    {
Karsten Hopp 9c3490
  		col = 0;
Karsten Hopp 9c3490
  		while (vim_regexec_multi(&regmatch, curwin, buf, lnum,
Karsten Hopp 9c3490
! 							       col, NULL) > 0)
Karsten Hopp 9c3490
  		{
Karsten Hopp 9c3490
  		    ;
Karsten Hopp 9c3490
  		    if (qf_add_entry(qi, &prevp,
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/regexp.c	Fri Jan 18 20:36:40 2008
Karsten Hopp 9c3490
--- src/regexp.c	Sat Jan 19 15:18:12 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3040,3046 ****
Karsten Hopp 9c3490
  } save_se_T;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  static char_u	*reg_getline __ARGS((linenr_T lnum));
Karsten Hopp 9c3490
! static long	vim_regexec_both __ARGS((char_u *line, colnr_T col));
Karsten Hopp 9c3490
  static long	regtry __ARGS((regprog_T *prog, colnr_T col));
Karsten Hopp 9c3490
  static void	cleanup_subexpr __ARGS((void));
Karsten Hopp 9c3490
  #ifdef FEAT_SYN_HL
Karsten Hopp 9c3490
--- 3040,3046 ----
Karsten Hopp 9c3490
  } save_se_T;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  static char_u	*reg_getline __ARGS((linenr_T lnum));
Karsten Hopp 9c3490
! static long	vim_regexec_both __ARGS((char_u *line, colnr_T col, proftime_T *tm));
Karsten Hopp 9c3490
  static long	regtry __ARGS((regprog_T *prog, colnr_T col));
Karsten Hopp 9c3490
  static void	cleanup_subexpr __ARGS((void));
Karsten Hopp 9c3490
  #ifdef FEAT_SYN_HL
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3284,3290 ****
Karsten Hopp 9c3490
      ireg_icombine = FALSE;
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
      ireg_maxcol = 0;
Karsten Hopp 9c3490
!     return (vim_regexec_both(line, col) != 0);
Karsten Hopp 9c3490
  }
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
Karsten Hopp 9c3490
--- 3284,3290 ----
Karsten Hopp 9c3490
      ireg_icombine = FALSE;
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
      ireg_maxcol = 0;
Karsten Hopp 9c3490
!     return (vim_regexec_both(line, col, NULL) != 0);
Karsten Hopp 9c3490
  }
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  #if defined(FEAT_MODIFY_FNAME) || defined(FEAT_EVAL) \
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3308,3314 ****
Karsten Hopp 9c3490
      ireg_icombine = FALSE;
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
      ireg_maxcol = 0;
Karsten Hopp 9c3490
!     return (vim_regexec_both(line, col) != 0);
Karsten Hopp 9c3490
  }
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
--- 3308,3314 ----
Karsten Hopp 9c3490
      ireg_icombine = FALSE;
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
      ireg_maxcol = 0;
Karsten Hopp 9c3490
!     return (vim_regexec_both(line, col, NULL) != 0);
Karsten Hopp 9c3490
  }
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3321,3332 ****
Karsten Hopp 9c3490
   * match otherwise.
Karsten Hopp 9c3490
   */
Karsten Hopp 9c3490
      long
Karsten Hopp 9c3490
! vim_regexec_multi(rmp, win, buf, lnum, col)
Karsten Hopp 9c3490
      regmmatch_T	*rmp;
Karsten Hopp 9c3490
      win_T	*win;		/* window in which to search or NULL */
Karsten Hopp 9c3490
      buf_T	*buf;		/* buffer in which to search */
Karsten Hopp 9c3490
      linenr_T	lnum;		/* nr of line to start looking for match */
Karsten Hopp 9c3490
      colnr_T	col;		/* column to start looking for match */
Karsten Hopp 9c3490
  {
Karsten Hopp 9c3490
      long	r;
Karsten Hopp 9c3490
      buf_T	*save_curbuf = curbuf;
Karsten Hopp 9c3490
--- 3321,3333 ----
Karsten Hopp 9c3490
   * match otherwise.
Karsten Hopp 9c3490
   */
Karsten Hopp 9c3490
      long
Karsten Hopp 9c3490
! vim_regexec_multi(rmp, win, buf, lnum, col, tm)
Karsten Hopp 9c3490
      regmmatch_T	*rmp;
Karsten Hopp 9c3490
      win_T	*win;		/* window in which to search or NULL */
Karsten Hopp 9c3490
      buf_T	*buf;		/* buffer in which to search */
Karsten Hopp 9c3490
      linenr_T	lnum;		/* nr of line to start looking for match */
Karsten Hopp 9c3490
      colnr_T	col;		/* column to start looking for match */
Karsten Hopp 9c3490
+     proftime_T	*tm;		/* timeout limit or NULL */
Karsten Hopp 9c3490
  {
Karsten Hopp 9c3490
      long	r;
Karsten Hopp 9c3490
      buf_T	*save_curbuf = curbuf;
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3346,3352 ****
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
      /* Need to switch to buffer "buf" to make vim_iswordc() work. */
Karsten Hopp 9c3490
      curbuf = buf;
Karsten Hopp 9c3490
!     r = vim_regexec_both(NULL, col);
Karsten Hopp 9c3490
      curbuf = save_curbuf;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
      return r;
Karsten Hopp 9c3490
--- 3347,3353 ----
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
      /* Need to switch to buffer "buf" to make vim_iswordc() work. */
Karsten Hopp 9c3490
      curbuf = buf;
Karsten Hopp 9c3490
!     r = vim_regexec_both(NULL, col, tm);
Karsten Hopp 9c3490
      curbuf = save_curbuf;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
      return r;
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3356,3365 ****
Karsten Hopp 9c3490
   * Match a regexp against a string ("line" points to the string) or multiple
Karsten Hopp 9c3490
   * lines ("line" is NULL, use reg_getline()).
Karsten Hopp 9c3490
   */
Karsten Hopp 9c3490
      static long
Karsten Hopp 9c3490
! vim_regexec_both(line, col)
Karsten Hopp 9c3490
      char_u	*line;
Karsten Hopp 9c3490
      colnr_T	col;		/* column to start looking for match */
Karsten Hopp 9c3490
  {
Karsten Hopp 9c3490
      regprog_T	*prog;
Karsten Hopp 9c3490
      char_u	*s;
Karsten Hopp 9c3490
--- 3357,3368 ----
Karsten Hopp 9c3490
   * Match a regexp against a string ("line" points to the string) or multiple
Karsten Hopp 9c3490
   * lines ("line" is NULL, use reg_getline()).
Karsten Hopp 9c3490
   */
Karsten Hopp 9c3490
+ /*ARGSUSED*/
Karsten Hopp 9c3490
      static long
Karsten Hopp 9c3490
! vim_regexec_both(line, col, tm)
Karsten Hopp 9c3490
      char_u	*line;
Karsten Hopp 9c3490
      colnr_T	col;		/* column to start looking for match */
Karsten Hopp 9c3490
+     proftime_T	*tm;		/* timeout limit or NULL */
Karsten Hopp 9c3490
  {
Karsten Hopp 9c3490
      regprog_T	*prog;
Karsten Hopp 9c3490
      char_u	*s;
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3502,3507 ****
Karsten Hopp 9c3490
--- 3505,3513 ----
Karsten Hopp 9c3490
      }
Karsten Hopp 9c3490
      else
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
+ #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+ 	int tm_count = 0;
Karsten Hopp 9c3490
+ #endif
Karsten Hopp 9c3490
  	/* Messy cases:  unanchored match. */
Karsten Hopp 9c3490
  	while (!got_int)
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3550,3555 ****
Karsten Hopp 9c3490
--- 3556,3570 ----
Karsten Hopp 9c3490
  	    else
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  		++col;
Karsten Hopp 9c3490
+ #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+ 	    /* Check for timeout once in a twenty times to avoid overhead. */
Karsten Hopp 9c3490
+ 	    if (tm != NULL && ++tm_count == 20)
Karsten Hopp 9c3490
+ 	    {
Karsten Hopp 9c3490
+ 		tm_count = 0;
Karsten Hopp 9c3490
+ 		if (profile_passed_limit(tm))
Karsten Hopp 9c3490
+ 		    break;
Karsten Hopp 9c3490
+ 	    }
Karsten Hopp 9c3490
+ #endif
Karsten Hopp 9c3490
  	}
Karsten Hopp 9c3490
      }
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/proto/regexp.pro	Sat May  5 19:42:08 2007
Karsten Hopp 9c3490
--- src/proto/regexp.pro	Sat Jan 19 13:14:09 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 1,13 ****
Karsten Hopp 9c3490
  /* regexp.c */
Karsten Hopp 9c3490
- void free_regexp_stuff __ARGS((void));
Karsten Hopp 9c3490
  int re_multiline __ARGS((regprog_T *prog));
Karsten Hopp 9c3490
  int re_lookbehind __ARGS((regprog_T *prog));
Karsten Hopp 9c3490
  char_u *skip_regexp __ARGS((char_u *startp, int dirc, int magic, char_u **newp));
Karsten Hopp 9c3490
  regprog_T *vim_regcomp __ARGS((char_u *expr, int re_flags));
Karsten Hopp 9c3490
  int vim_regcomp_had_eol __ARGS((void));
Karsten Hopp 9c3490
  int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
Karsten Hopp 9c3490
  int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
Karsten Hopp 9c3490
! long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col));
Karsten Hopp 9c3490
  reg_extmatch_T *ref_extmatch __ARGS((reg_extmatch_T *em));
Karsten Hopp 9c3490
  void unref_extmatch __ARGS((reg_extmatch_T *em));
Karsten Hopp 9c3490
  char_u *regtilde __ARGS((char_u *source, int magic));
Karsten Hopp 9c3490
--- 1,13 ----
Karsten Hopp 9c3490
  /* regexp.c */
Karsten Hopp 9c3490
  int re_multiline __ARGS((regprog_T *prog));
Karsten Hopp 9c3490
  int re_lookbehind __ARGS((regprog_T *prog));
Karsten Hopp 9c3490
  char_u *skip_regexp __ARGS((char_u *startp, int dirc, int magic, char_u **newp));
Karsten Hopp 9c3490
  regprog_T *vim_regcomp __ARGS((char_u *expr, int re_flags));
Karsten Hopp 9c3490
  int vim_regcomp_had_eol __ARGS((void));
Karsten Hopp 9c3490
+ void free_regexp_stuff __ARGS((void));
Karsten Hopp 9c3490
  int vim_regexec __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
Karsten Hopp 9c3490
  int vim_regexec_nl __ARGS((regmatch_T *rmp, char_u *line, colnr_T col));
Karsten Hopp 9c3490
! long vim_regexec_multi __ARGS((regmmatch_T *rmp, win_T *win, buf_T *buf, linenr_T lnum, colnr_T col, proftime_T *tm));
Karsten Hopp 9c3490
  reg_extmatch_T *ref_extmatch __ARGS((reg_extmatch_T *em));
Karsten Hopp 9c3490
  void unref_extmatch __ARGS((reg_extmatch_T *em));
Karsten Hopp 9c3490
  char_u *regtilde __ARGS((char_u *source, int magic));
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/proto/search.pro	Sun Jan  6 20:05:36 2008
Karsten Hopp 9c3490
--- src/proto/search.pro	Fri Jan 18 21:03:49 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 11,17 ****
Karsten Hopp 9c3490
  void set_last_search_pat __ARGS((char_u *s, int idx, int magic, int setlast));
Karsten Hopp 9c3490
  void last_pat_prog __ARGS((regmmatch_T *regmatch));
Karsten Hopp 9c3490
  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));
Karsten Hopp 9c3490
! int do_search __ARGS((oparg_T *oap, int dirc, char_u *pat, long count, int options));
Karsten Hopp 9c3490
  int search_for_exact_line __ARGS((buf_T *buf, pos_T *pos, int dir, char_u *pat));
Karsten Hopp 9c3490
  int searchc __ARGS((cmdarg_T *cap, int t_cmd));
Karsten Hopp 9c3490
  pos_T *findmatch __ARGS((oparg_T *oap, int initc));
Karsten Hopp 9c3490
--- 11,17 ----
Karsten Hopp 9c3490
  void set_last_search_pat __ARGS((char_u *s, int idx, int magic, int setlast));
Karsten Hopp 9c3490
  void last_pat_prog __ARGS((regmmatch_T *regmatch));
Karsten Hopp 9c3490
  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));
Karsten Hopp 9c3490
! int do_search __ARGS((oparg_T *oap, int dirc, char_u *pat, long count, int options, proftime_T *tm));
Karsten Hopp 9c3490
  int search_for_exact_line __ARGS((buf_T *buf, pos_T *pos, int dir, char_u *pat));
Karsten Hopp 9c3490
  int searchc __ARGS((cmdarg_T *cap, int t_cmd));
Karsten Hopp 9c3490
  pos_T *findmatch __ARGS((oparg_T *oap, int initc));
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/search.c	Sun Jan  6 20:05:36 2008
Karsten Hopp 9c3490
--- src/search.c	Sat Jan 19 13:13:25 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 606,612 ****
Karsten Hopp 9c3490
  		 * Look for a match somewhere in line "lnum".
Karsten Hopp 9c3490
  		 */
Karsten Hopp 9c3490
  		nmatched = vim_regexec_multi(&regmatch, win, buf,
Karsten Hopp 9c3490
! 							    lnum, (colnr_T)0);
Karsten Hopp 9c3490
  		/* Abort searching on an error (e.g., out of stack). */
Karsten Hopp 9c3490
  		if (called_emsg)
Karsten Hopp 9c3490
  		    break;
Karsten Hopp 9c3490
--- 606,618 ----
Karsten Hopp 9c3490
  		 * Look for a match somewhere in line "lnum".
Karsten Hopp 9c3490
  		 */
Karsten Hopp 9c3490
  		nmatched = vim_regexec_multi(&regmatch, win, buf,
Karsten Hopp 9c3490
! 						      lnum, (colnr_T)0,
Karsten Hopp 9c3490
! #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
! 						      tm
Karsten Hopp 9c3490
! #else
Karsten Hopp 9c3490
! 						      NULL
Karsten Hopp 9c3490
! #endif
Karsten Hopp 9c3490
! 						      );
Karsten Hopp 9c3490
  		/* Abort searching on an error (e.g., out of stack). */
Karsten Hopp 9c3490
  		if (called_emsg)
Karsten Hopp 9c3490
  		    break;
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 615,623 ****
Karsten Hopp 9c3490
  		    /* match may actually be in another line when using \zs */
Karsten Hopp 9c3490
  		    matchpos = regmatch.startpos[0];
Karsten Hopp 9c3490
  		    endpos = regmatch.endpos[0];
Karsten Hopp 9c3490
! # ifdef FEAT_EVAL
Karsten Hopp 9c3490
  		    submatch = first_submatch(&regmatch);
Karsten Hopp 9c3490
! # endif
Karsten Hopp 9c3490
  		    /* Line me be past end of buffer for "\n\zs". */
Karsten Hopp 9c3490
  		    if (lnum + matchpos.lnum > buf->b_ml.ml_line_count)
Karsten Hopp 9c3490
  			ptr = (char_u *)"";
Karsten Hopp 9c3490
--- 621,629 ----
Karsten Hopp 9c3490
  		    /* match may actually be in another line when using \zs */
Karsten Hopp 9c3490
  		    matchpos = regmatch.startpos[0];
Karsten Hopp 9c3490
  		    endpos = regmatch.endpos[0];
Karsten Hopp 9c3490
! #ifdef FEAT_EVAL
Karsten Hopp 9c3490
  		    submatch = first_submatch(&regmatch);
Karsten Hopp 9c3490
! #endif
Karsten Hopp 9c3490
  		    /* Line me be past end of buffer for "\n\zs". */
Karsten Hopp 9c3490
  		    if (lnum + matchpos.lnum > buf->b_ml.ml_line_count)
Karsten Hopp 9c3490
  			ptr = (char_u *)"";
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 693,699 ****
Karsten Hopp 9c3490
  			    if (ptr[matchcol] == NUL
Karsten Hopp 9c3490
  				    || (nmatched = vim_regexec_multi(&regmatch,
Karsten Hopp 9c3490
  					      win, buf, lnum + matchpos.lnum,
Karsten Hopp 9c3490
! 					      matchcol)) == 0)
Karsten Hopp 9c3490
  			    {
Karsten Hopp 9c3490
  				match_ok = FALSE;
Karsten Hopp 9c3490
  				break;
Karsten Hopp 9c3490
--- 699,711 ----
Karsten Hopp 9c3490
  			    if (ptr[matchcol] == NUL
Karsten Hopp 9c3490
  				    || (nmatched = vim_regexec_multi(&regmatch,
Karsten Hopp 9c3490
  					      win, buf, lnum + matchpos.lnum,
Karsten Hopp 9c3490
! 					      matchcol,
Karsten Hopp 9c3490
! #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
! 					      tm
Karsten Hopp 9c3490
! #else
Karsten Hopp 9c3490
! 					      NULL
Karsten Hopp 9c3490
! #endif
Karsten Hopp 9c3490
! 					      )) == 0)
Karsten Hopp 9c3490
  			    {
Karsten Hopp 9c3490
  				match_ok = FALSE;
Karsten Hopp 9c3490
  				break;
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 799,805 ****
Karsten Hopp 9c3490
  			    if (ptr[matchcol] == NUL
Karsten Hopp 9c3490
  				    || (nmatched = vim_regexec_multi(&regmatch,
Karsten Hopp 9c3490
  					      win, buf, lnum + matchpos.lnum,
Karsten Hopp 9c3490
! 							      matchcol)) == 0)
Karsten Hopp 9c3490
  				break;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  			    /* Need to get the line pointer again, a
Karsten Hopp 9c3490
--- 811,823 ----
Karsten Hopp 9c3490
  			    if (ptr[matchcol] == NUL
Karsten Hopp 9c3490
  				    || (nmatched = vim_regexec_multi(&regmatch,
Karsten Hopp 9c3490
  					      win, buf, lnum + matchpos.lnum,
Karsten Hopp 9c3490
! 					      matchcol,
Karsten Hopp 9c3490
! #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
! 					      tm
Karsten Hopp 9c3490
! #else
Karsten Hopp 9c3490
! 					      NULL
Karsten Hopp 9c3490
! #endif
Karsten Hopp 9c3490
! 					    )) == 0)
Karsten Hopp 9c3490
  				break;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  			    /* Need to get the line pointer again, a
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 977,988 ****
Karsten Hopp 9c3490
   * return 0 for failure, 1 for found, 2 for found and line offset added
Karsten Hopp 9c3490
   */
Karsten Hopp 9c3490
      int
Karsten Hopp 9c3490
! do_search(oap, dirc, pat, count, options)
Karsten Hopp 9c3490
      oparg_T	    *oap;	/* can be NULL */
Karsten Hopp 9c3490
      int		    dirc;	/* '/' or '?' */
Karsten Hopp 9c3490
      char_u	   *pat;
Karsten Hopp 9c3490
      long	    count;
Karsten Hopp 9c3490
      int		    options;
Karsten Hopp 9c3490
  {
Karsten Hopp 9c3490
      pos_T	    pos;	/* position of the last match */
Karsten Hopp 9c3490
      char_u	    *searchstr;
Karsten Hopp 9c3490
--- 995,1007 ----
Karsten Hopp 9c3490
   * return 0 for failure, 1 for found, 2 for found and line offset added
Karsten Hopp 9c3490
   */
Karsten Hopp 9c3490
      int
Karsten Hopp 9c3490
! do_search(oap, dirc, pat, count, options, tm)
Karsten Hopp 9c3490
      oparg_T	    *oap;	/* can be NULL */
Karsten Hopp 9c3490
      int		    dirc;	/* '/' or '?' */
Karsten Hopp 9c3490
      char_u	   *pat;
Karsten Hopp 9c3490
      long	    count;
Karsten Hopp 9c3490
      int		    options;
Karsten Hopp 9c3490
+     proftime_T	    *tm;	/* timeout limit or NULL */
Karsten Hopp 9c3490
  {
Karsten Hopp 9c3490
      pos_T	    pos;	/* position of the last match */
Karsten Hopp 9c3490
      char_u	    *searchstr;
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 1256,1262 ****
Karsten Hopp 9c3490
  		       (SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS
Karsten Hopp 9c3490
  			+ SEARCH_MSG + SEARCH_START
Karsten Hopp 9c3490
  			+ ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))),
Karsten Hopp 9c3490
! 		RE_LAST, (linenr_T)0, NULL);
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  	if (dircp != NULL)
Karsten Hopp 9c3490
  	    *dircp = dirc;	/* restore second '/' or '?' for normal_cmd() */
Karsten Hopp 9c3490
--- 1275,1281 ----
Karsten Hopp 9c3490
  		       (SEARCH_KEEP + SEARCH_PEEK + SEARCH_HIS
Karsten Hopp 9c3490
  			+ SEARCH_MSG + SEARCH_START
Karsten Hopp 9c3490
  			+ ((pat != NULL && *pat == ';') ? 0 : SEARCH_NOOF))),
Karsten Hopp 9c3490
! 		RE_LAST, (linenr_T)0, tm);
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  	if (dircp != NULL)
Karsten Hopp 9c3490
  	    *dircp = dirc;	/* restore second '/' or '?' for normal_cmd() */
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/screen.c	Sat Jan 12 16:45:25 2008
Karsten Hopp 9c3490
--- src/screen.c	Sat Jan 19 13:52:29 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 848,858 ****
Karsten Hopp 9c3490
--- 848,863 ----
Karsten Hopp 9c3490
  	cur->hl.buf = buf;
Karsten Hopp 9c3490
  	cur->hl.lnum = 0;
Karsten Hopp 9c3490
  	cur->hl.first_lnum = 0;
Karsten Hopp 9c3490
+ # ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+ 	/* Set the time limit to 'redrawtime'. */
Karsten Hopp 9c3490
+ 	profile_setlimit(p_rdt, &(cur->hl.tm));
Karsten Hopp 9c3490
+ # endif
Karsten Hopp 9c3490
  	cur = cur->next;
Karsten Hopp 9c3490
      }
Karsten Hopp 9c3490
      search_hl.buf = buf;
Karsten Hopp 9c3490
      search_hl.lnum = 0;
Karsten Hopp 9c3490
      search_hl.first_lnum = 0;
Karsten Hopp 9c3490
+     /* time limit is set at the toplevel, for all windows */
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  #ifdef FEAT_LINEBREAK
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 6462,6467 ****
Karsten Hopp 9c3490
--- 6467,6476 ----
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
  	last_pat_prog(&search_hl.rm);
Karsten Hopp 9c3490
  	search_hl.attr = hl_attr(HLF_L);
Karsten Hopp 9c3490
+ # ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+ 	/* Set the time limit to 'redrawtime'. */
Karsten Hopp 9c3490
+ 	profile_setlimit(p_rdt, &search_hl.tm);
Karsten Hopp 9c3490
+ # endif
Karsten Hopp 9c3490
      }
Karsten Hopp 9c3490
  }
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 6587,6592 ****
Karsten Hopp 9c3490
--- 6596,6609 ----
Karsten Hopp 9c3490
      called_emsg = FALSE;
Karsten Hopp 9c3490
      for (;;)
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
+ #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+ 	/* Stop searching after passing the time limit. */
Karsten Hopp 9c3490
+ 	if (profile_passed_limit(&(shl->tm)))
Karsten Hopp 9c3490
+ 	{
Karsten Hopp 9c3490
+ 	    shl->lnum = 0;		/* no match found in time */
Karsten Hopp 9c3490
+ 	    break;
Karsten Hopp 9c3490
+ 	}
Karsten Hopp 9c3490
+ #endif
Karsten Hopp 9c3490
  	/* Three situations:
Karsten Hopp 9c3490
  	 * 1. No useful previous match: search from start of line.
Karsten Hopp 9c3490
  	 * 2. Not Vi compatible or empty match: continue at next character.
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 6620,6626 ****
Karsten Hopp 9c3490
  	    matchcol = shl->rm.endpos[0].col;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  	shl->lnum = lnum;
Karsten Hopp 9c3490
! 	nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol);
Karsten Hopp 9c3490
  	if (called_emsg)
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
  	    /* Error while handling regexp: stop using this regexp. */
Karsten Hopp 9c3490
--- 6637,6649 ----
Karsten Hopp 9c3490
  	    matchcol = shl->rm.endpos[0].col;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  	shl->lnum = lnum;
Karsten Hopp 9c3490
! 	nmatched = vim_regexec_multi(&shl->rm, win, shl->buf, lnum, matchcol,
Karsten Hopp 9c3490
! #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
! 		&(shl->tm)
Karsten Hopp 9c3490
! #else
Karsten Hopp 9c3490
! 		NULL
Karsten Hopp 9c3490
! #endif
Karsten Hopp 9c3490
! 		);
Karsten Hopp 9c3490
  	if (called_emsg)
Karsten Hopp 9c3490
  	{
Karsten Hopp 9c3490
  	    /* Error while handling regexp: stop using this regexp. */
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/option.h	Thu May 10 20:34:47 2007
Karsten Hopp 9c3490
--- src/option.h	Sat Jan 19 13:45:51 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 633,638 ****
Karsten Hopp 9c3490
--- 633,641 ----
Karsten Hopp 9c3490
  #ifdef FEAT_SEARCHPATH
Karsten Hopp 9c3490
  EXTERN char_u	*p_cdpath;	/* 'cdpath' */
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
+ #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+ EXTERN long	p_rdt;		/* 'redrawtime' */
Karsten Hopp 9c3490
+ #endif
Karsten Hopp 9c3490
  EXTERN int	p_remap;	/* 'remap' */
Karsten Hopp 9c3490
  EXTERN long	p_report;	/* 'report' */
Karsten Hopp 9c3490
  #if defined(FEAT_WINDOWS) && defined(FEAT_QUICKFIX)
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/spell.c	Sat Jan 12 16:45:25 2008
Karsten Hopp 9c3490
--- src/spell.c	Fri Jan 18 21:02:47 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 10343,10349 ****
Karsten Hopp 9c3490
      curwin->w_cursor.lnum = 0;
Karsten Hopp 9c3490
      while (!got_int)
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
! 	if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP) == 0
Karsten Hopp 9c3490
  						   || u_save_cursor() == FAIL)
Karsten Hopp 9c3490
  	    break;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
--- 10343,10349 ----
Karsten Hopp 9c3490
      curwin->w_cursor.lnum = 0;
Karsten Hopp 9c3490
      while (!got_int)
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
! 	if (do_search(NULL, '/', frompat, 1L, SEARCH_KEEP, NULL) == 0
Karsten Hopp 9c3490
  						   || u_save_cursor() == FAIL)
Karsten Hopp 9c3490
  	    break;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/structs.h	Mon Oct  1 22:53:27 2007
Karsten Hopp 9c3490
--- src/structs.h	Fri Jan 18 21:18:53 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 1717,1722 ****
Karsten Hopp 9c3490
--- 1717,1725 ----
Karsten Hopp 9c3490
      linenr_T	first_lnum;	/* first lnum to search for multi-line pat */
Karsten Hopp 9c3490
      colnr_T	startcol; /* in win_line() points to char where HL starts */
Karsten Hopp 9c3490
      colnr_T	endcol;	 /* in win_line() points to char where HL ends */
Karsten Hopp 9c3490
+ #ifdef FEAT_RELTIME
Karsten Hopp 9c3490
+     proftime_T	tm;	/* for a time limit */
Karsten Hopp 9c3490
+ #endif
Karsten Hopp 9c3490
  } match_T;
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  /*
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/syntax.c	Sun Jan 13 17:39:29 2008
Karsten Hopp 9c3490
--- src/syntax.c	Sat Jan 19 13:13:49 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3097,3103 ****
Karsten Hopp 9c3490
      colnr_T	col;
Karsten Hopp 9c3490
  {
Karsten Hopp 9c3490
      rmp->rmm_maxcol = syn_buf->b_p_smc;
Karsten Hopp 9c3490
!     if (vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col) > 0)
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
  	rmp->startpos[0].lnum += lnum;
Karsten Hopp 9c3490
  	rmp->endpos[0].lnum += lnum;
Karsten Hopp 9c3490
--- 3097,3103 ----
Karsten Hopp 9c3490
      colnr_T	col;
Karsten Hopp 9c3490
  {
Karsten Hopp 9c3490
      rmp->rmm_maxcol = syn_buf->b_p_smc;
Karsten Hopp 9c3490
!     if (vim_regexec_multi(rmp, syn_win, syn_buf, lnum, col, NULL) > 0)
Karsten Hopp 9c3490
      {
Karsten Hopp 9c3490
  	rmp->startpos[0].lnum += lnum;
Karsten Hopp 9c3490
  	rmp->endpos[0].lnum += lnum;
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/tag.c	Thu May 10 19:44:07 2007
Karsten Hopp 9c3490
--- src/tag.c	Fri Jan 18 21:03:41 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3191,3197 ****
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  	    save_lnum = curwin->w_cursor.lnum;
Karsten Hopp 9c3490
  	    curwin->w_cursor.lnum = 0;	/* start search before first line */
Karsten Hopp 9c3490
! 	    if (do_search(NULL, pbuf[0], pbuf + 1, (long)1, search_options))
Karsten Hopp 9c3490
  		retval = OK;
Karsten Hopp 9c3490
  	    else
Karsten Hopp 9c3490
  	    {
Karsten Hopp 9c3490
--- 3191,3198 ----
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  	    save_lnum = curwin->w_cursor.lnum;
Karsten Hopp 9c3490
  	    curwin->w_cursor.lnum = 0;	/* start search before first line */
Karsten Hopp 9c3490
! 	    if (do_search(NULL, pbuf[0], pbuf + 1, (long)1,
Karsten Hopp 9c3490
! 							search_options, NULL))
Karsten Hopp 9c3490
  		retval = OK;
Karsten Hopp 9c3490
  	    else
Karsten Hopp 9c3490
  	    {
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3203,3209 ****
Karsten Hopp 9c3490
  		 */
Karsten Hopp 9c3490
  		p_ic = TRUE;
Karsten Hopp 9c3490
  		if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1,
Karsten Hopp 9c3490
! 							      search_options))
Karsten Hopp 9c3490
  		{
Karsten Hopp 9c3490
  		    /*
Karsten Hopp 9c3490
  		     * Failed to find pattern, take a guess: "^func  ("
Karsten Hopp 9c3490
--- 3204,3210 ----
Karsten Hopp 9c3490
  		 */
Karsten Hopp 9c3490
  		p_ic = TRUE;
Karsten Hopp 9c3490
  		if (!do_search(NULL, pbuf[0], pbuf + 1, (long)1,
Karsten Hopp 9c3490
! 							search_options, NULL))
Karsten Hopp 9c3490
  		{
Karsten Hopp 9c3490
  		    /*
Karsten Hopp 9c3490
  		     * Failed to find pattern, take a guess: "^func  ("
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 3213,3225 ****
Karsten Hopp 9c3490
  		    cc = *tagp.tagname_end;
Karsten Hopp 9c3490
  		    *tagp.tagname_end = NUL;
Karsten Hopp 9c3490
  		    sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname);
Karsten Hopp 9c3490
! 		    if (!do_search(NULL, '/', pbuf, (long)1, search_options))
Karsten Hopp 9c3490
  		    {
Karsten Hopp 9c3490
  			/* Guess again: "^char * \
Karsten Hopp 9c3490
  			sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
Karsten Hopp 9c3490
  								tagp.tagname);
Karsten Hopp 9c3490
  			if (!do_search(NULL, '/', pbuf, (long)1,
Karsten Hopp 9c3490
! 							      search_options))
Karsten Hopp 9c3490
  			    found = 0;
Karsten Hopp 9c3490
  		    }
Karsten Hopp 9c3490
  		    *tagp.tagname_end = cc;
Karsten Hopp 9c3490
--- 3214,3227 ----
Karsten Hopp 9c3490
  		    cc = *tagp.tagname_end;
Karsten Hopp 9c3490
  		    *tagp.tagname_end = NUL;
Karsten Hopp 9c3490
  		    sprintf((char *)pbuf, "^%s\\s\\*(", tagp.tagname);
Karsten Hopp 9c3490
! 		    if (!do_search(NULL, '/', pbuf, (long)1,
Karsten Hopp 9c3490
! 							search_options, NULL))
Karsten Hopp 9c3490
  		    {
Karsten Hopp 9c3490
  			/* Guess again: "^char * \
Karsten Hopp 9c3490
  			sprintf((char *)pbuf, "^\\[#a-zA-Z_]\\.\\*\\<%s\\s\\*(",
Karsten Hopp 9c3490
  								tagp.tagname);
Karsten Hopp 9c3490
  			if (!do_search(NULL, '/', pbuf, (long)1,
Karsten Hopp 9c3490
! 							search_options, NULL))
Karsten Hopp 9c3490
  			    found = 0;
Karsten Hopp 9c3490
  		    }
Karsten Hopp 9c3490
  		    *tagp.tagname_end = cc;
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/vim.h	Sat Jan  5 13:34:01 2008
Karsten Hopp 9c3490
--- src/vim.h	Fri Jan 18 21:29:22 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 1550,1555 ****
Karsten Hopp 9c3490
--- 1550,1565 ----
Karsten Hopp 9c3490
  # define MB_MAXBYTES	21
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
+ #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO)
Karsten Hopp 9c3490
+ # ifdef WIN3264
Karsten Hopp 9c3490
+ typedef LARGE_INTEGER proftime_T;
Karsten Hopp 9c3490
+ # else
Karsten Hopp 9c3490
+ typedef struct timeval proftime_T;
Karsten Hopp 9c3490
+ # endif
Karsten Hopp 9c3490
+ #else
Karsten Hopp 9c3490
+ typedef int proftime_T;	    /* dummy for function prototypes */
Karsten Hopp 9c3490
+ #endif
Karsten Hopp 9c3490
+ 
Karsten Hopp 9c3490
  /* Include option.h before structs.h, because the number of window-local and
Karsten Hopp 9c3490
   * buffer-local options is used there. */
Karsten Hopp 9c3490
  #include "option.h"	    /* options and default values */
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 1760,1775 ****
Karsten Hopp 9c3490
  # include <io.h>	    /* for access() */
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  # define stat(a,b) (access(a,0) ? -1 : stat(a,b))
Karsten Hopp 9c3490
- #endif
Karsten Hopp 9c3490
- 
Karsten Hopp 9c3490
- #if (defined(FEAT_PROFILE) || defined(FEAT_RELTIME)) && !defined(PROTO)
Karsten Hopp 9c3490
- # ifdef WIN3264
Karsten Hopp 9c3490
- typedef LARGE_INTEGER proftime_T;
Karsten Hopp 9c3490
- # else
Karsten Hopp 9c3490
- typedef struct timeval proftime_T;
Karsten Hopp 9c3490
- # endif
Karsten Hopp 9c3490
- #else
Karsten Hopp 9c3490
- typedef int proftime_T;	    /* dummy for function prototypes */
Karsten Hopp 9c3490
  #endif
Karsten Hopp 9c3490
  
Karsten Hopp 9c3490
  #include "ex_cmds.h"	    /* Ex command defines */
Karsten Hopp 9c3490
--- 1770,1775 ----
Karsten Hopp 9c3490
*** ../vim-7.1.235/src/version.c	Fri Jan 18 20:36:40 2008
Karsten Hopp 9c3490
--- src/version.c	Sat Jan 19 15:19:48 2008
Karsten Hopp 9c3490
***************
Karsten Hopp 9c3490
*** 668,669 ****
Karsten Hopp 9c3490
--- 668,671 ----
Karsten Hopp 9c3490
  {   /* Add new patch number below this line */
Karsten Hopp 9c3490
+ /**/
Karsten Hopp 9c3490
+     236,
Karsten Hopp 9c3490
  /**/
Karsten Hopp 9c3490
Karsten Hopp 9c3490
-- 
Karsten Hopp 9c3490
Every time I lose weight, it finds me again!
Karsten Hopp 9c3490
Karsten Hopp 9c3490
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 9c3490
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 9c3490
\\\        download, build and distribute -- http://www.A-A-P.org        ///
Karsten Hopp 9c3490
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///