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