Blame SOURCES/7.4.582

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