Karsten Hopp 6bb483
To: vim_dev@googlegroups.com
Karsten Hopp 6bb483
Subject: Patch 7.4.806
Karsten Hopp 6bb483
Fcc: outbox
Karsten Hopp 6bb483
From: Bram Moolenaar <Bram@moolenaar.net>
Karsten Hopp 6bb483
Mime-Version: 1.0
Karsten Hopp 6bb483
Content-Type: text/plain; charset=UTF-8
Karsten Hopp 6bb483
Content-Transfer-Encoding: 8bit
Karsten Hopp 6bb483
------------
Karsten Hopp 6bb483
Karsten Hopp 6bb483
Patch 7.4.806
Karsten Hopp 6bb483
Problem:    CTRL-A in Visual mode doesn't work properly with "alpha" in
Karsten Hopp 6bb483
            'nrformat'.
Karsten Hopp 6bb483
Solution:   Make it work. (Christian Brabandt)
Karsten Hopp 6bb483
Files:      src/ops.c, src/testdir/test_increment.in,
Karsten Hopp 6bb483
            src/testdir/test_increment.ok
Karsten Hopp 6bb483
Karsten Hopp 6bb483
Karsten Hopp 6bb483
*** ../vim-7.4.805/src/ops.c	2015-07-28 21:17:31.526069349 +0200
Karsten Hopp 6bb483
--- src/ops.c	2015-08-04 18:22:23.110938512 +0200
Karsten Hopp 6bb483
***************
Karsten Hopp 6bb483
*** 5492,5497 ****
Karsten Hopp 6bb483
--- 5492,5499 ----
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
      for (i = lnum; i <= lnume; i++)
Karsten Hopp 6bb483
      {
Karsten Hopp 6bb483
+ 	colnr_T stop = 0;
Karsten Hopp 6bb483
+ 
Karsten Hopp 6bb483
  	t = curwin->w_cursor;
Karsten Hopp 6bb483
  	curwin->w_cursor.lnum = i;
Karsten Hopp 6bb483
  	ptr = ml_get_curline();
Karsten Hopp 6bb483
***************
Karsten Hopp 6bb483
*** 5501,5531 ****
Karsten Hopp 6bb483
  	    continue;
Karsten Hopp 6bb483
  	if (visual)
Karsten Hopp 6bb483
  	{
Karsten Hopp 6bb483
! 	    if (doalp) /* search for ascii chars */
Karsten Hopp 6bb483
! 	    {
Karsten Hopp 6bb483
! 		while (!ASCII_ISALPHA(ptr[col]) && ptr[col])
Karsten Hopp 6bb483
! 		    col++;
Karsten Hopp 6bb483
! 	    }
Karsten Hopp 6bb483
! 	    /* skip to first digit, but allow for leading '-' */
Karsten Hopp 6bb483
! 	    else if (dohex)
Karsten Hopp 6bb483
  	    {
Karsten Hopp 6bb483
! 		while (!(vim_isxdigit(ptr[col]) || (ptr[col] == '-'
Karsten Hopp 6bb483
! 				    && vim_isxdigit(ptr[col+1]))) && ptr[col])
Karsten Hopp 6bb483
! 		    col++;
Karsten Hopp 6bb483
  	    }
Karsten Hopp 6bb483
! 	    else /* decimal */
Karsten Hopp 6bb483
  	    {
Karsten Hopp 6bb483
! 		while (!(vim_isdigit(ptr[col]) || (ptr[col] == '-'
Karsten Hopp 6bb483
! 				     && vim_isdigit(ptr[col+1]))) && ptr[col])
Karsten Hopp 6bb483
! 		    col++;
Karsten Hopp 6bb483
  	    }
Karsten Hopp 6bb483
  	}
Karsten Hopp 6bb483
- 	if (visual && ptr[col] == '-')
Karsten Hopp 6bb483
- 	{
Karsten Hopp 6bb483
- 	    negative = TRUE;
Karsten Hopp 6bb483
- 	    was_positive = FALSE;
Karsten Hopp 6bb483
- 	    col++;
Karsten Hopp 6bb483
- 	}
Karsten Hopp 6bb483
  	/*
Karsten Hopp 6bb483
  	 * If a number was found, and saving for undo works, replace the number.
Karsten Hopp 6bb483
  	 */
Karsten Hopp 6bb483
--- 5503,5530 ----
Karsten Hopp 6bb483
  	    continue;
Karsten Hopp 6bb483
  	if (visual)
Karsten Hopp 6bb483
  	{
Karsten Hopp 6bb483
! 	    if (VIsual_mode == 'v'
Karsten Hopp 6bb483
! 		    && i == lnume)
Karsten Hopp 6bb483
! 		stop = curwin->w_cursor.col;
Karsten Hopp 6bb483
! 	    else if (VIsual_mode == Ctrl_V
Karsten Hopp 6bb483
! 		    && curbuf->b_visual.vi_curswant != MAXCOL)
Karsten Hopp 6bb483
! 		stop = curwin->w_cursor.col;
Karsten Hopp 6bb483
! 
Karsten Hopp 6bb483
! 	    while (ptr[col] != NUL
Karsten Hopp 6bb483
! 		    && !vim_isdigit(ptr[col])
Karsten Hopp 6bb483
! 		    && !(doalp && ASCII_ISALPHA(ptr[col])))
Karsten Hopp 6bb483
  	    {
Karsten Hopp 6bb483
! 		if (col > 0  && col == stop)
Karsten Hopp 6bb483
! 		    break;
Karsten Hopp 6bb483
! 		++col;
Karsten Hopp 6bb483
  	    }
Karsten Hopp 6bb483
! 
Karsten Hopp 6bb483
! 	    if (col > startcol && ptr[col - 1] == '-')
Karsten Hopp 6bb483
  	    {
Karsten Hopp 6bb483
! 		negative = TRUE;
Karsten Hopp 6bb483
! 		was_positive = FALSE;
Karsten Hopp 6bb483
  	    }
Karsten Hopp 6bb483
  	}
Karsten Hopp 6bb483
  	/*
Karsten Hopp 6bb483
  	 * If a number was found, and saving for undo works, replace the number.
Karsten Hopp 6bb483
  	 */
Karsten Hopp 6bb483
*** ../vim-7.4.805/src/testdir/test_increment.in	2015-07-17 13:03:42.108357465 +0200
Karsten Hopp 6bb483
--- src/testdir/test_increment.in	2015-08-04 18:18:44.421419280 +0200
Karsten Hopp 6bb483
***************
Karsten Hopp 6bb483
*** 260,265 ****
Karsten Hopp 6bb483
--- 260,275 ----
Karsten Hopp 6bb483
    9
Karsten Hopp 6bb483
    12
Karsten Hopp 6bb483
    
Karsten Hopp 6bb483
+ 19) increment on number with nrformat including alpha
Karsten Hopp 6bb483
+ Text:
Karsten Hopp 6bb483
+  1
Karsten Hopp 6bb483
+  1a
Karsten Hopp 6bb483
+ 
Karsten Hopp 6bb483
+  Expected:
Karsten Hopp 6bb483
+  1) <Ctrl-V>j$ <ctrl-a>
Karsten Hopp 6bb483
+  2
Karsten Hopp 6bb483
+  1b
Karsten Hopp 6bb483
+    
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
  STARTTEST
Karsten Hopp 6bb483
***************
Karsten Hopp 6bb483
*** 369,374 ****
Karsten Hopp 6bb483
--- 379,391 ----
Karsten Hopp 6bb483
  :/^E18=/+put a
Karsten Hopp 6bb483
  V3kg?..
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
+ :" Test 19
Karsten Hopp 6bb483
+ :set nrformats+=alpha
Karsten Hopp 6bb483
+ :/^S19=/+,/^E19=/-y a
Karsten Hopp 6bb483
+ :/^E19=/+put a
Karsten Hopp 6bb483
+ ?k$?
Karsten Hopp 6bb483
+ :set nrformats&vim
Karsten Hopp 6bb483
+ 
Karsten Hopp 6bb483
  :" Save the report
Karsten Hopp 6bb483
  :/^# Test 1/,$w! test.out
Karsten Hopp 6bb483
  :qa!
Karsten Hopp 6bb483
***************
Karsten Hopp 6bb483
*** 547,552 ****
Karsten Hopp 6bb483
--- 564,576 ----
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
+ # Test 19
Karsten Hopp 6bb483
+ S19====
Karsten Hopp 6bb483
+ 1
Karsten Hopp 6bb483
+ 1a
Karsten Hopp 6bb483
+ E19====
Karsten Hopp 6bb483
+ 
Karsten Hopp 6bb483
+ 
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
  ENDTEST
Karsten Hopp 6bb483
*** ../vim-7.4.805/src/testdir/test_increment.ok	2015-07-17 13:03:42.108357465 +0200
Karsten Hopp 6bb483
--- src/testdir/test_increment.ok	2015-08-04 18:18:44.425419233 +0200
Karsten Hopp 6bb483
***************
Karsten Hopp 6bb483
*** 261,266 ****
Karsten Hopp 6bb483
--- 261,275 ----
Karsten Hopp 6bb483
  12
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
+ # Test 19
Karsten Hopp 6bb483
+ S19====
Karsten Hopp 6bb483
+ 1
Karsten Hopp 6bb483
+ 1a
Karsten Hopp 6bb483
+ E19====
Karsten Hopp 6bb483
+ 
Karsten Hopp 6bb483
+ 2
Karsten Hopp 6bb483
+ 2a
Karsten Hopp 6bb483
+ 
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
  
Karsten Hopp 6bb483
  ENDTEST
Karsten Hopp 6bb483
*** ../vim-7.4.805/src/version.c	2015-08-04 17:43:20.577543527 +0200
Karsten Hopp 6bb483
--- src/version.c	2015-08-04 18:08:55.096101557 +0200
Karsten Hopp 6bb483
***************
Karsten Hopp 6bb483
*** 743,744 ****
Karsten Hopp 6bb483
--- 743,746 ----
Karsten Hopp 6bb483
  {   /* Add new patch number below this line */
Karsten Hopp 6bb483
+ /**/
Karsten Hopp 6bb483
+     806,
Karsten Hopp 6bb483
  /**/
Karsten Hopp 6bb483
Karsten Hopp 6bb483
-- 
Karsten Hopp 6bb483
Not too long ago, compress was something you did to garbage...
Karsten Hopp 6bb483
Karsten Hopp 6bb483
 /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net   \\\
Karsten Hopp 6bb483
///        sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
Karsten Hopp 6bb483
\\\  an exciting new programming language -- http://www.Zimbu.org        ///
Karsten Hopp 6bb483
 \\\            help me help AIDS victims -- http://ICCF-Holland.org    ///