Karsten Hopp c63678
To: vim_dev@googlegroups.com
Karsten Hopp c63678
Subject: Patch 7.4.582
Karsten Hopp c63678
Fcc: outbox
Karsten Hopp c63678
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp c63678
Mime-Version: 1.0
Karsten Hopp c63678
Content-Type: text/plain; charset=UTF-8
Karsten Hopp c63678
Content-Transfer-Encoding: 8bit
Karsten Hopp c63678
------------
Karsten Hopp c63678
Karsten Hopp c63678
Patch 7.4.582 (after 7.4.577)
Karsten Hopp c63678
Problem:    Can't match "%>80v" properly. (Axel Bender)
Karsten Hopp c63678
Solution:   Correctly handle ">". (Christian Brabandt)
Karsten Hopp c63678
Files:	    src/regexp_nfa.c, src/testdir/test64.in, src/testdir/test64.ok
Karsten Hopp c63678
Karsten Hopp c63678
Karsten Hopp c63678
*** ../vim-7.4.581/src/regexp_nfa.c	2015-01-14 18:40:23.083769507 +0100
Karsten Hopp c63678
--- src/regexp_nfa.c	2015-01-18 16:38:05.437339384 +0100
Karsten Hopp c63678
***************
Karsten Hopp c63678
*** 6441,6456 ****
Karsten Hopp c63678
  		{
Karsten Hopp c63678
  		    int     op = t->state->c - NFA_VCOL;
Karsten Hopp c63678
  		    colnr_T col = (colnr_T)(reginput - regline);
Karsten Hopp c63678
  
Karsten Hopp c63678
  		    /* Bail out quickly when there can't be a match, avoid the
Karsten Hopp c63678
  		     * overhead of win_linetabsize() on long lines. */
Karsten Hopp c63678
! 		    if ((col > t->state->val && op != 1)
Karsten Hopp c63678
! 			    || (col - 1 > t->state->val && op == 1))
Karsten Hopp c63678
  			break;
Karsten Hopp c63678
! 		    result = nfa_re_num_cmp(t->state->val, op,
Karsten Hopp c63678
! 			(long_u)win_linetabsize(
Karsten Hopp c63678
! 				reg_win == NULL ? curwin : reg_win,
Karsten Hopp c63678
! 							   regline, col) + 1);
Karsten Hopp c63678
  		    if (result)
Karsten Hopp c63678
  		    {
Karsten Hopp c63678
  			add_here = TRUE;
Karsten Hopp c63678
--- 6441,6466 ----
Karsten Hopp c63678
  		{
Karsten Hopp c63678
  		    int     op = t->state->c - NFA_VCOL;
Karsten Hopp c63678
  		    colnr_T col = (colnr_T)(reginput - regline);
Karsten Hopp c63678
+ 		    win_T   *wp = reg_win == NULL ? curwin : reg_win;
Karsten Hopp c63678
  
Karsten Hopp c63678
  		    /* Bail out quickly when there can't be a match, avoid the
Karsten Hopp c63678
  		     * overhead of win_linetabsize() on long lines. */
Karsten Hopp c63678
! 		    if (op != 1 && col > t->state->val)
Karsten Hopp c63678
  			break;
Karsten Hopp c63678
! 		    result = FALSE;
Karsten Hopp c63678
! 		    if (op == 1 && col - 1 > t->state->val && col > 100)
Karsten Hopp c63678
! 		    {
Karsten Hopp c63678
! 			int ts = wp->w_buffer->b_p_ts;
Karsten Hopp c63678
! 
Karsten Hopp c63678
! 			/* Guess that a character won't use more columns than
Karsten Hopp c63678
! 			 * 'tabstop', with a minimum of 4. */
Karsten Hopp c63678
! 			if (ts < 4)
Karsten Hopp c63678
! 			    ts = 4;
Karsten Hopp c63678
! 			result = col > t->state->val * ts;
Karsten Hopp c63678
! 		    }
Karsten Hopp c63678
! 		    if (!result)
Karsten Hopp c63678
! 			result = nfa_re_num_cmp(t->state->val, op,
Karsten Hopp c63678
! 				(long_u)win_linetabsize(wp, regline, col) + 1);
Karsten Hopp c63678
  		    if (result)
Karsten Hopp c63678
  		    {
Karsten Hopp c63678
  			add_here = TRUE;
Karsten Hopp c63678
*** ../vim-7.4.581/src/testdir/test64.in	2014-08-29 11:56:21.350422045 +0200
Karsten Hopp c63678
--- src/testdir/test64.in	2015-01-18 16:09:31.852099488 +0100
Karsten Hopp c63678
***************
Karsten Hopp c63678
*** 7,12 ****
Karsten Hopp c63678
--- 7,13 ----
Karsten Hopp c63678
  STARTTEST
Karsten Hopp c63678
  :so small.vim
Karsten Hopp c63678
  :" tl is a List of Lists with:
Karsten Hopp c63678
+ :"    regexp engine
Karsten Hopp c63678
  :"    regexp pattern
Karsten Hopp c63678
  :"    text to test the pattern on
Karsten Hopp c63678
  :"    expected match (optional)
Karsten Hopp c63678
***************
Karsten Hopp c63678
*** 451,456 ****
Karsten Hopp c63678
--- 452,460 ----
Karsten Hopp c63678
  :"""" Skip adding state twice
Karsten Hopp c63678
  :call add(tl, [2, '^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=', "#if FOO", "#if", ' FOO'])
Karsten Hopp c63678
  :"
Karsten Hopp c63678
+ :""" Test \%V atom
Karsten Hopp c63678
+ :call add(tl, [2, '\%>70vGesamt', 'Jean-Michel Charlier & Victor Hubinon\Gesamtausgabe [Salleck]    Buck Danny {Jean-Michel Charlier & Victor Hubinon}\Gesamtausgabe', 'Gesamt'])
Karsten Hopp c63678
+ :"
Karsten Hopp c63678
  :"""" Run the tests
Karsten Hopp c63678
  :"
Karsten Hopp c63678
  :for t in tl
Karsten Hopp c63678
*** ../vim-7.4.581/src/testdir/test64.ok	2014-08-29 11:56:21.350422045 +0200
Karsten Hopp c63678
--- src/testdir/test64.ok	2015-01-18 16:09:31.852099488 +0100
Karsten Hopp c63678
***************
Karsten Hopp c63678
*** 1030,1035 ****
Karsten Hopp c63678
--- 1030,1038 ----
Karsten Hopp c63678
  OK 0 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=
Karsten Hopp c63678
  OK 1 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=
Karsten Hopp c63678
  OK 2 - ^\%(\%(^\s*#\s*if\>\|#\s*if\)\)\(\%>1c.*$\)\@=
Karsten Hopp c63678
+ OK 0 - \%>70vGesamt
Karsten Hopp c63678
+ OK 1 - \%>70vGesamt
Karsten Hopp c63678
+ OK 2 - \%>70vGesamt
Karsten Hopp c63678
  multi-line tests
Karsten Hopp c63678
  OK 0 - ^.\(.\).\_..\1.
Karsten Hopp c63678
  OK 1 - ^.\(.\).\_..\1.
Karsten Hopp c63678
*** ../vim-7.4.581/src/version.c	2015-01-18 14:08:52.699436994 +0100
Karsten Hopp c63678
--- src/version.c	2015-01-18 16:12:32.682119256 +0100
Karsten Hopp c63678
***************
Karsten Hopp c63678
*** 743,744 ****
Karsten Hopp c63678
--- 743,746 ----
Karsten Hopp c63678
  {   /* Add new patch number below this line */
Karsten Hopp c63678
+ /**/
Karsten Hopp c63678
+     582,
Karsten Hopp c63678
  /**/
Karsten Hopp c63678
Karsten Hopp c63678
-- 
Karsten Hopp c63678
There's no place like $(HOME)!
Karsten Hopp c63678
Karsten Hopp c63678
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp c63678
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp c63678
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp c63678
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///