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