Blame SOURCES/7.4.577

22c937
To: vim_dev@googlegroups.com
22c937
Subject: Patch 7.4.577
22c937
Fcc: outbox
22c937
From: Bram Moolenaar <Bram@moolenaar.net>
22c937
Mime-Version: 1.0
22c937
Content-Type: text/plain; charset=UTF-8
22c937
Content-Transfer-Encoding: 8bit
22c937
------------
22c937
22c937
Patch 7.4.577
22c937
Problem:    Matching with a virtual column has a lot of overhead on very long
22c937
	    lines. (Issue 310)
22c937
Solution:   Bail out early if there can't be a match. (Christian Brabandt)
22c937
	    Also check for CTRL-C at every position.
22c937
Files:	    src/regexp_nfa.c
22c937
22c937
22c937
*** ../vim-7.4.576/src/regexp_nfa.c	2014-11-23 15:57:45.568009419 +0100
22c937
--- src/regexp_nfa.c	2015-01-14 18:40:12.263887756 +0100
22c937
***************
22c937
*** 6438,6451 ****
22c937
  	    case NFA_VCOL:
22c937
  	    case NFA_VCOL_GT:
22c937
  	    case NFA_VCOL_LT:
22c937
- 		result = nfa_re_num_cmp(t->state->val, t->state->c - NFA_VCOL,
22c937
- 		    (long_u)win_linetabsize(
22c937
- 			    reg_win == NULL ? curwin : reg_win,
22c937
- 			    regline, (colnr_T)(reginput - regline)) + 1);
22c937
- 		if (result)
22c937
  		{
22c937
! 		    add_here = TRUE;
22c937
! 		    add_state = t->state->out;
22c937
  		}
22c937
  		break;
22c937
  
22c937
--- 6438,6461 ----
22c937
  	    case NFA_VCOL:
22c937
  	    case NFA_VCOL_GT:
22c937
  	    case NFA_VCOL_LT:
22c937
  		{
22c937
! 		    int     op = t->state->c - NFA_VCOL;
22c937
! 		    colnr_T col = (colnr_T)(reginput - regline);
22c937
! 
22c937
! 		    /* Bail out quickly when there can't be a match, avoid the
22c937
! 		     * overhead of win_linetabsize() on long lines. */
22c937
! 		    if ((col > t->state->val && op != 1)
22c937
! 			    || (col - 1 > t->state->val && op == 1))
22c937
! 			break;
22c937
! 		    result = nfa_re_num_cmp(t->state->val, op,
22c937
! 			(long_u)win_linetabsize(
22c937
! 				reg_win == NULL ? curwin : reg_win,
22c937
! 							   regline, col) + 1);
22c937
! 		    if (result)
22c937
! 		    {
22c937
! 			add_here = TRUE;
22c937
! 			add_state = t->state->out;
22c937
! 		    }
22c937
  		}
22c937
  		break;
22c937
  
22c937
***************
22c937
*** 6744,6749 ****
22c937
--- 6754,6764 ----
22c937
  	    reg_nextline();
22c937
  	else
22c937
  	    break;
22c937
+ 
22c937
+ 	/* Allow interrupting with CTRL-C. */
22c937
+ 	fast_breakcheck();
22c937
+ 	if (got_int)
22c937
+ 	    break;
22c937
      }
22c937
  
22c937
  #ifdef ENABLE_LOG
22c937
*** ../vim-7.4.576/src/version.c	2015-01-14 17:52:26.603094340 +0100
22c937
--- src/version.c	2015-01-14 18:34:10.375843602 +0100
22c937
***************
22c937
*** 743,744 ****
22c937
--- 743,746 ----
22c937
  {   /* Add new patch number below this line */
22c937
+ /**/
22c937
+     577,
22c937
  /**/
22c937
22c937
-- 
22c937
From "know your smileys":
22c937
 !-|	I-am-a-Cylon-Centurian-with-one-red-eye-bouncing-back-and-forth
22c937
22c937
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
22c937
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
22c937
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
22c937
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///